How to fill JointTrajectory structure with data
Has anybody examples how the JointTrajectory msg structure in ROS2 can be defined and filled with data in c++?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Has anybody examples how the JointTrajectory msg structure in ROS2 can be defined and filled with data in c++?
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;
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.
Asked: 2022-11-05 15:45:51 -0500
Seen: 16,767 times
Last updated: Nov 06 '22
Subscriber callback not triggering while in a while loop
ROS2: How to publish cv Mat image?
Working with cv_bridge and OpenCV correctly
How can I check what middleware I am using in ros2?
Environment setup error - term 'call' is not recognized in PowerShell
SMACC or any other state machine for ROS2
ROS 2 Crystal : Can't get parameter list of string from YAML file