diff --git a/CMakeLists.txt b/CMakeLists.txt index 8da6be9..46b9a03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/autopilot.cpp b/src/autopilot.cpp index 4c95b26..89f6897 100644 --- a/src/autopilot.cpp +++ b/src/autopilot.cpp @@ -8,15 +8,15 @@ int main(int argc, char** argv) // Subscribe to the cmd_vel topic ros::NodeHandle nh; - ros::Publisher cmdVelPub = nh.advertise("cmd_vel",1); + ros::Publisher cmdVelPub = nh.advertise("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(); }