Troubles to move turtlebot_gazebo
I started a small project where I wanted to move the turtlebot in gazebo. I launched: roslaunch turtlebot_gazebo turtlebot_world.launch
I wrote a code to move it:
#include "ros/ros.h"
#include "geometry_msgs/TwistWithCovariance.h"
#include "nav_msgs/Odometry.h"
#include "gazebo_msgs/LinkState.h"
#include "geometry_msgs/Twist.h"
int main(int argc, char **argv){
ros::init(argc,argv,"move");
ros::NodeHandle n;
ros::Publisher move_pub = n.advertise<geometry_msgs::Twist>("moving",1000);
ros::Rate loop_rate(10);
geometry_msgs::Twist msg;
while(ros::ok()){
msg.linear.x = 0.0;
msg.linear.y = 0.0;
msg.linear.z = 20.0;
move_pub.publish(msg);
ros::spinOnce();
loop_rate.sleep();
}
}
This doesn't work. As you can see i included other msgs and tried it with them but I got the same result. I also tried to find the node turtlebot_teleop_keyboard to find out how it is done by inputs. But i couldn't find the path to it. So what do I have to do to move it? And how can I find the path to the node?
Thank you in advance
I also tried it with x = 20.0 or y
First if you want to move the turtlebot since it's not a drone publishing a
linear.z
command won't do anything you have to uselinear.x
to move forward/backward andorientation.z
to turn.Secondly, why are you publishing on the topic
/moving
? It's usually the topiccmd_vel
that is usedIf you want to teleop the turtlebot, since the mobile base of the turtlebot is a kobuki you just have to use :