Write a ROS subscriber [closed]
To write my own subscriber, I followed the guide from http://wiki.ros.org/ROS/Tutorials/Wri.... However, I want to use my own Rosmsg type. Currently I have a hpp file include the class of the ROS type. And I have a .msg file. In order to write callback function, what should we include ?
Currently, I imported the hpp file generated from LCM message and did "void Callback(const leg_control_data_lcmt& msg) ". However, the errors pops up. I wonder how to construct a correct message type that I can use in callback function ?
leg_control_data_lcmt.hpp is something like the following
class leg_control_data_lcmt
{
public:
float q[12];
float qd[12];
float p[12];
float v[12];
float tau_est[12];
}
Which errors pops up? Reading your question, straight away I see you're not using the package namespace before the message, something like your_package::leg_control_data_lcmt and you could also use your_package::leg_control_data_lcmt::ConstPtr& instead.
Teo is right and also check if you are including the correct header. You header file most probably goes to
catkin_ws/devel/include/
after you build. so includeyour_package/Your_Msg_File_Name.h
Please don't post duplicate questions. You have already posted this question here.