Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 84

Ros subscriber - Passing msg data to the callback

$
0
0
I have a custom msg data file containing the data field names that I wish to use for a project. This data is published in a topic, that is written in Python. What I am trying to do is create a C++ script (Subscriber) that subscribes to this topic and displays a particular name within the msg data. So far I have written the following: void callback(const leap_motion_sensor::leap& msg) { ROS_INFO("I heard" + msg); } int main(int argc, char** argv) { ros::init(argc, argv, "features"); ros::NodeHandle n; //ros::Timer timer1 = n.createTimer(ros::Duration(0.08), callback); ros::Subscriber sub = n.subscribe("/leapmotion/data", callback); ros::spin(); return 0; } I get the following warning message: [WARN] [WallTime: 1390260279.317426] Could not process inbound connection: topic t types do not match: [leap_motion_sensor/leap] vs. [leap_motion_sensor/leapros] {'topic': '/leapmotion/data', 'tcp_nodelay': '0', 'md5sum': '3e9a0dc7fd1a98f1d7489e9011c78807', 'type': 'leap_motion_sensor/leap', 'callerid': '/features'} Here is what the msg file contains: Header header float64[3] hand_direction float64[3] hand_normal float64[3] hand_palm_pos float64 hand_pitch float64 hand_roll float64 hand_yaw I just want to copy the data from the "hand_direction" into a `std::vector` Is this possible and if so, what needs to be in my callback function in order to be able to pass through this data? Thanks

Viewing all articles
Browse latest Browse all 84

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>