Create the first autopilot version to make the robot spin
This commit is contained in:
parent
27e6ab1251
commit
68f7cab51c
|
|
@ -134,6 +134,9 @@ include_directories(
|
|||
## The recommended prefix ensures that target names across packages don't collide
|
||||
# add_executable(${PROJECT_NAME}_node src/autopilot_node.cpp)
|
||||
|
||||
add_executable(autopilot src/autopilot.cpp)
|
||||
target_link_libraries(autopilot ${catkin_LIBRARIES})
|
||||
|
||||
## Rename C++ executable without prefix
|
||||
## The above recommended prefix causes long target names, the following renames the
|
||||
## target back to the shorter version for ease of user use
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@ int main(int argc, char** argv)
|
|||
|
||||
// Subscribe to the cmd_vel topic
|
||||
ros::NodeHandle nh;
|
||||
ros::Publisher cmdVelPub = nh.advertise<geometry_msg::Twist>("cmd_vel",1);
|
||||
ros::Publisher cmdVelPub = nh.advertise<geometry_msgs::Twist>("cmd_vel",1);
|
||||
|
||||
ros::Rate loopRate(10);
|
||||
|
||||
while(ros::ok())
|
||||
{
|
||||
geometry_msg::Twist msg;
|
||||
geometry_msgs::Twist msg;
|
||||
msg.angular.z =1;
|
||||
mdVelPub.publish(msg);
|
||||
cmdVelPub.publish(msg);
|
||||
ros::spinOnce();
|
||||
loopRate.sleep();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue