project_file.cpp created, containing the bone structure of a publisher
This commit is contained in:
parent
eb3a94c1d4
commit
a4d7cc020e
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
Date: 22nd of November 2022
|
||||||
|
|
||||||
|
Authors: Adrien Lasserre (adrien.lasserre@ecam.fr) and Gwenn Durpoix-Espinasson (g.durpoix-espinasson@ecam.fr)
|
||||||
|
|
||||||
|
Context: This cpp file is part of the second lab of the Advanced_Robotics course at ECAM. This course is taught by Guillaume Gibert (guillaume.gibert@ecam.fr).
|
||||||
|
The main goal of this file is to create a ROS node publishing on the /cmd_vel topic of a Turtlebot3 educational robot.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ros/ros.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
ros::init(argc, argv, "commander");
|
||||||
|
ros::NodeHandle nh;
|
||||||
|
ros::Publisher commanderPublisher =
|
||||||
|
nh.advertise<geometry_msgs::Twist>("cmd_vel", 1);
|
||||||
|
ros::Rate loopRate(10);
|
||||||
|
|
||||||
|
while(ros::ok()){
|
||||||
|
commanderPublisher.publish();
|
||||||
|
ros::spinOnce();
|
||||||
|
loopRate.sleep();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue