Communication between node and topic

asked 2016-04-14 11:20:59 -0600

papaclaudia gravatar image

Hi! I have this rqt_graph: rqt.png I wish /cmd_vel topic writes values on /mavros node. The node on which I work is mavros_node.cpp. Initially it was so:

#include <mavros/mavros.h>

int main(int argc, char *argv[])
{
ros::init(argc, argv, "mavros");

mavros::MavRos mavros;
mavros.spin();

return 0;
}

Now I have modified it for my case as well:

#include <mavros/mavros.h>
#include <geometry_msgs/TwistStamped.h>

int main(int argc, char **argv)
{
ros::init(argc, argv, "mavros");
ros::NodeHandle n;
ros::Subscriber mav_sub = n.subscribe<geometry_msgs::TwistStamped>("/cmd_vel", 10);
ros::Rate loop_rate(10);
mavros::MavRos mavros;
mavros.spin();

return 0;
}

but I can not fill with catkin_make because errors there are. Can anyone help me? Thanks in advance.

edit retag flag offensive close merge delete

Comments

It would help if you list the commands you are running and the errors you are getting, and maybe a little about your workspace and environment (OS, ROS version).

Thomas D gravatar imageThomas D ( 2016-04-14 15:03:52 -0600 )edit

I follow this steps:

rosrun hector_exploration_controller simple_exploration_controller
roslaunch apm.launch

(this is from https://github.com/mavlink/mavros/blo... )

papaclaudia gravatar imagepapaclaudia ( 2016-04-15 03:53:41 -0600 )edit

can you paste your errors?

bluking gravatar imagebluking ( 2016-04-18 03:48:32 -0600 )edit