ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to fill JointTrajectory structure with data

asked 2022-11-05 15:45:51 -0600

GUENNI gravatar image

updated 2022-11-06 08:33:21 -0600

Has anybody examples how the JointTrajectory msg structure in ROS2 can be defined and filled with data in c++?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2022-11-06 08:37:00 -0600

GUENNI gravatar image

I think now it worked. With a few tries I did this:

auto hw_cmd = std::shared_ptr<trajectory_msgs__msg__JointTrajectory>() ; std::string hip ="hip"; std::string shoulder ="shoulder"; hw_cmd->[0] = hip; hw_cmd->[1] = shoulder;

edit flag offensive delete link more

answered 2022-11-06 05:04:53 -0600

ljaniec gravatar image

I think these functions can get you a gist of how you use it with C++:

Knowledge of iterators and a bit of STL is assumed.

edit flag offensive delete link more

Question Tools



Asked: 2022-11-05 15:45:51 -0600

Seen: 16,615 times

Last updated: Nov 06 '22