Add the cpp file

This commit is contained in:
Justin CHARMETANT 2024-11-07 09:03:32 +01:00
parent ce22facfa4
commit 27e6ab1251
1 changed files with 24 additions and 0 deletions

24
src/autopilot.cpp Normal file
View File

@ -0,0 +1,24 @@
#include <ros/ros.h>
#include "std_msgs/String.h"
#include <geometry_msgs/Twist.h>
int main(int argc, char** argv)
{
ros::init(argc,argv, "autopilot");
// Subscribe to the cmd_vel topic
ros::NodeHandle nh;
ros::Publisher cmdVelPub = nh.advertise<geometry_msg::Twist>("cmd_vel",1);
ros::Rate loopRate(10);
while(ros::ok())
{
geometry_msg::Twist msg;
msg.angular.z =1;
mdVelPub.publish(msg);
ros::spinOnce();
loopRate.sleep();
}
return 0;
}