Commit 126e8df5 authored by Capp's avatar Capp

[node] add node for controlling lidar velocity

parent 819427ed
......@@ -7,7 +7,7 @@ project(sensor_training_result)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED)
find_package(catkin REQUIRED roscpp std_msgs)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
......@@ -112,8 +112,8 @@ catkin_package(
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
# ${catkin_INCLUDE_DIRS}
include
${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
......@@ -129,7 +129,7 @@ include_directories(
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/sensor_training_result_node.cpp)
add_executable(rotate_lidar_node src/rotate_lidar.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
......@@ -142,9 +142,9 @@ include_directories(
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
target_link_libraries(rotate_lidar_node
${catkin_LIBRARIES}
)
#############
## Install ##
......
#include <ros/ros.h>
#include <std_msgs/Float64.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "rotate_lidar_node");
ros::NodeHandle nh;
ros::NodeHandle pnh("~");
ros::Rate rate(1);
ros::Publisher pub = nh.advertise<std_msgs::Float64>("/laser_velocity_controller/command", 10);
std_msgs::Float64 vel; vel.data = 1.0;
while(ros::ok()){
pub.publish(vel);
rate.sleep();
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment