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

How to fill JointTrajectory structure with data

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

GUENNI gravatar image

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

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
0

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

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->joint_names.data[0] = hip; hw_cmd->joint_names.data[1] = shoulder;

edit flag offensive delete link more
0

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

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

2 followers

Stats

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

Seen: 16,767 times

Last updated: Nov 06 '22