Created
May 4, 2018 11:18
-
-
Save jdumont0201/48ab63560d4adbc0b54cc88391b91d89 to your computer and use it in GitHub Desktop.
ROS Robot speed change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ros/ros.h> | |
#include <geometry_msgs/Twist.h> | |
int main(int argc, char** argv) { | |
ros::init(argc, argv, "topic_publisher"); ros::NodeHandle nh; | |
ros::Publisher pub = nh.advertise("cmd_vel",1000); | |
ros::Rate loop_rate(2); | |
geometry_msgs::Twist twist; | |
twist.linear.x=0.5; | |
twist.linear.z=0.5; | |
while (ros::ok()) | |
{ | |
pub.publish(twist); | |
ros::spinOnce(); | |
loop_rate.sleep(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment