1

I'm trying to publish to the topic /joy/set_feedback.

I had this in my include:

#include <sensor_msgs/JoyFeedbackArray.h>

I had my Nodehandle and Publisher like this :

feed_pub = nh->advertise<sensor_msgs::JoyFeedbackArray>("/joy/set_feedback", 1);

Now my problem is that i want to fill up the feed_msg

sensor_msgs::JoyFeedbackArray feed_msg;

In the documentation sensor_msgs/JoyFeedbackArray Message it says it's an array. No matter what i did wrote there, I always get an error.

It would be very helpful if i could get a correct example to fill up this array.

I'll be needing a vibration signal with type: 1 / id: 0 / intensity: 1.0.

Slachcrash
  • 27
  • 1
  • 6

1 Answers1

0

ROS messages can handle something like Arrays. But when you are working with a ROS Message-"Array" in Python or C++, you need to use a different data type. In your case, you need a std::Vector<sensor_msgs::JoyFeedback>.

For other cases, the ROS Wiki has created a table of translations between ROS Message, C++ and Python:

enter image description here

You can find a detailed explaination of the different datatypes and their conversion between ROS Message and Python or C++ here: http://wiki.ros.org/msg

Jere
  • 1,196
  • 1
  • 9
  • 31