Skip to content

Instantly share code, notes, and snippets.

@jdumont0201
Created May 4, 2018 11:18
Show Gist options
  • Save jdumont0201/48ab63560d4adbc0b54cc88391b91d89 to your computer and use it in GitHub Desktop.
Save jdumont0201/48ab63560d4adbc0b54cc88391b91d89 to your computer and use it in GitHub Desktop.
ROS Robot speed change
#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