#include <ros/ros.h> // For the ROS system #include <geometry_msgs/Twist.h> // Twist message type #include <cstdlib.h> // For Random number generator int main( int argc, char ** argv ) { ros::init( argc, argv, "randomwalk_generator" ); ros::NodeHandle node_handle; ROS_INFO_STREAM("Welcome to the world of tomorrow!"); ros::Publisher vel_cmd_publisher = node_handle.advertise<geometry_msgs::Twist>("turtlebot1/cmd_vel", 1000); ros::Rate rate(2); while ( ros::ok() ) { geometry_msgs::Twist msg; msg.linear.x = double(rand())/RAND_MAX; msg.angular.z = 2*double(rand())/RAND_MAX -1; vel_cmd_publisher.publish(msg); rate.sleep(); } return 0; }