Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Topic not being created properly

Hello, I am using ROS groovy and I have created a .cpp file that is suppose to use the command_velocity topic in conjunction with ros turtlesim to move the simulated turtlebot in a direction, When I compiled my code every went fine with catkin_make. Now that I run my code though it seems like the command_velocity topic is not being created or anything is being published at all.

#include <ros/ros.h>
#include <geometry_msgs/Twist.h>
int main(int argc, char **argv){
ros::init(argc, argv, "move");
ros::NodeHandle n;
ros::Publisher move_bot = n.advertise<geometry_msgs::Twist>("cmd_vel_mux/input/teleop",1);
geometry_msgs::Twist vel;
vel.angular.z = 1.5;
vel.linear.x = 1.5;
move_bot.publish(vel);

ros::spin();
return 0;
 }

I am not sure what the problem is and I am fairly new to ROS programming any insight would be appreciated, thank you.

Topic not being created properly

Hello, I am using ROS groovy and I have created a .cpp file that is suppose to use the command_velocity topic in conjunction with ros turtlesim to move the simulated turtlebot in a direction, When I compiled my code every everything went fine with catkin_make. Now that I run my code though it seems like the command_velocity topic is not being created or anything is being published at all.

#include <ros/ros.h>
#include <geometry_msgs/Twist.h>
int main(int argc, char **argv){
ros::init(argc, argv, "move");
ros::NodeHandle n;
ros::Publisher move_bot = n.advertise<geometry_msgs::Twist>("cmd_vel_mux/input/teleop",1);
geometry_msgs::Twist vel;
vel.angular.z = 1.5;
vel.linear.x = 1.5;
move_bot.publish(vel);

ros::spin();
return 0;
 }

I am not sure what the problem is and I am fairly new to ROS programming any insight would be appreciated, thank you.