Skip to content

Conversation

eevanwong
Copy link

No description provided.

int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<KillTurtlesSubscriber>());
Copy link

@nico-palmar nico-palmar Sep 15, 2023

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>(

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

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

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.

Copy link
Author

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants