Implementing code in Gazebo world plugin
BH
I would like to implement a code that moves a turtlebot straightforward and see it on Gazebo. At first, I tried to paste the code i a Gazebo Plugin but it looks like when I run a launch file that sets the robot on a planned world, it doesn't respond.
This is the code(without implementation in a Gazebo plugin):
/* * * Hello World and Crash for Turtlebot * * Moves Turtlebot forward until you ctrl + c * * Tested using TurtleBot 2, ROS Indigo, Ubuntu 14.04 * */
include
include
include
int main(int argc, char** argv)
{
//init the ROS node
// ROSINFOSTREAM("Hello World");
// ros::init(argc, argv, "robotdriver");
// ros::NodeHandle nh;
//
// //init publisher
// ros::Publisher cmdvelpub;
// cmdvelpub_ = nh.advertise
// //init direction that turtlebot should go
// geometrymsgs::Twist basecmd;
// basecmd.linear.x = basecmd.linear.y = basecmd.angular.z = 0;
//
// //and let's go forward by setting X to a positive value
// basecmd.linear.x = 0.25;
//
// ROSINFOSTREAM("And Crashing ... ctrl + c to stop me :)");
//
// while(nh.ok()) { //have we ctrl + C? If no... keep going!
// //"publish" sends the command to turtlebot to keep going
// cmdvelpub.publish(basecmd);
// }
// }
What should I do?
P.S By the way, how come I can't see the cmdvelmux topic by picking the topic visualization tab on Gazebo?
Asked by Haz88 on 2015-05-16 14:54:10 UTC
Comments