-
Notifications
You must be signed in to change notification settings - Fork 35
Evan UWRT Challenge #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
int main(int argc, char * argv[]) | ||
{ | ||
rclcpp::init(argc, argv); | ||
rclcpp::spin(std::make_shared<KillTurtlesSubscriber>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sooo you haven't used componetns here. Not the end of the world, but just search up ros2 components for your own knowledge.
MoveActionClient() | ||
: Node("move_action_client") | ||
{ | ||
this->client_ptr = rclcpp_action::create_client<move_action>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In C++ you don't really use this, it's just implied bc you are in the class. Also, for future reference, I would try to avoid pointers because they don't really benefit in any way... they are just kinda there. No need to change, just keep it in mind.
using move_action = challenge_package::action::Move; | ||
using goal_handle_move = rclcpp_action::ClientGoalHandle<move_action>; | ||
|
||
class MoveActionClient : public rclcpp::Node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically client is not needed and you can just send via command line.
} | ||
|
||
void publish_move_turtle_msg() { | ||
// Whats the difference between linear and angular? A: https://stackoverflow.com/questions/50976281/what-do-x-y-and-z-mean-in-geometry-msgs-twist-message-in-ros |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linear is linear velocity moving in XYZ direction, angular is veloctiy AROUND XYZ axes. You can't 'turn around' via linear velocity; you need angular velocity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I actually forgot to remove that, that was clarified when I finished this part.
// circle_msg.linear.z = 1; // doesnt matter cuz turtle only in 2D | ||
circle_msg.angular.x = 0; | ||
circle_msg.angular.y = 0; | ||
circle_msg.angular.z = 1; // spins around the z-axis, which would be in x and y. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, in theory this works bc your 'Z' angular constantly changes your linear 'Y' direction, so you end up moving in a circle.
No description provided.