Robotics StackExchange | Archived questions

Communication between node and topic

Hi! I have this rqtgraph: rqt.png I wish /cmdvel 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.

Asked by papaclaudia on 2016-04-14 11:20:59 UTC

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).

Asked by Thomas D on 2016-04-14 15:03:52 UTC

I follow this steps:

rosrun hector_exploration_controller simple_exploration_controller
roslaunch apm.launch

(this is from https://github.com/mavlink/mavros/blob/master/mavros/launch/apm.launch)

Asked by papaclaudia on 2016-04-15 03:53:41 UTC

can you paste your errors?

Asked by bluking on 2016-04-18 03:48:32 UTC

Answers