Last active
August 5, 2022 16:43
-
-
Save Natsu-Akatsuki/9dd3f275989b60bbea08358f97735753 to your computer and use it in GitHub Desktop.
ROS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<launch> | |
<!-- formatter: vscode XML tools (4 space) --> | |
<!-- 使用rosbag --> | |
<arg name="bag_file" default="$(find rangenet_plusplus)/rosbag/kitti_2011_09_30_drive_0027_synced.bag" /> | |
<node pkg="rosbag" type="play" name="rosbag" output="screen" args="$(arg bag_file) -s 20"> | |
<remap from="/points_raw" to="/raw_pointcloud" /> | |
</node> | |
<!-- 使用nodelet,rosparam和gdb --> | |
<node pkg="nodelet" type="nodelet" name="pcl_manager" args="manager" output="screen" launch-prefix="gdb -ex run --args" /> | |
<!-- 字段的filter+下采样+remove nan points --> | |
<node pkg="nodelet" type="nodelet" name="voxel_grid" args="load pcl/VoxelGrid pcl_manager" output="screen"> | |
<remap from="~input" to="/rslidar_points" /> | |
<remap from="~output" to="/voxel_grid/lidar_points" /> | |
<!-- False表示:只处理该范围的数据 --> | |
<rosparam> | |
filter_field_name: z | |
filter_limit_min: -1.0 | |
filter_limit_max: 2.0 | |
filter_limit_negative: True | |
leaf_size: 0.1 | |
</rosparam> | |
</node> | |
<!-- 使用环境变量和group tag --> | |
<arg name="use_hd_map" default="false" doc="是否使用高精度地图" /> | |
<arg name="lanelet2_map_path" default="$(env HOME)/data/map/gdut/gdut.osm" doc="高精度地图文件位置" /> | |
<arg name="lidar" default="rslidar" doc="velodyne/rslidar" /> | |
<group if="$(arg use_hd_map)"> | |
<group ns="map"> | |
<include file="$(find map_loader)/launch/lanelet2_map_loader.launch"> | |
<arg name="file_name" default="$(arg lanelet2_map_path)" /> | |
</include> | |
</group> | |
</group> | |
<!-- 使用静态TF --> | |
<!-- static_transform_publisher(2: relative to) x y z yaw pitch roll 父 子坐标系 --> | |
<!-- ZYX: 使用的是内旋坐标系 --> | |
<node pkg="tf2_ros" type="static_transform_publisher" name="lidar_2_camera" args="0, 0, 1, -1.570795, 0, -1.570795 lidar camera " /> | |
<!-- 使用rviz --> | |
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find rangenet_plusplus)/launch/rviz.rviz" /> | |
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.5) | |
project(composition) | |
# Default to C++14 | |
if(NOT CMAKE_CXX_STANDARD) | |
set(CMAKE_CXX_STANDARD 14) | |
endif() | |
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |
add_compile_options(-Wall -Wextra -Wpedantic) | |
endif() | |
find_package(ament_cmake REQUIRED) | |
find_package(example_interfaces REQUIRED) | |
find_package(rclcpp REQUIRED) | |
find_package(rclcpp_components REQUIRED) | |
find_package(rcutils REQUIRED) | |
find_package(std_msgs REQUIRED) | |
include_directories(include) | |
# create ament index resource which references the libraries in the binary dir | |
set(node_plugins "") | |
add_library(talker_component SHARED | |
src/talker_component.cpp) | |
target_compile_definitions(talker_component | |
PRIVATE "COMPOSITION_BUILDING_DLL") | |
ament_target_dependencies(talker_component | |
"rclcpp" | |
"rclcpp_components" | |
"std_msgs") | |
rclcpp_components_register_nodes(talker_component "composition::Talker") | |
set(node_plugins "${node_plugins}composition::Talker;$<TARGET_FILE:talker_component>\n") | |
# since the package installs libraries without exporting them | |
# it needs to make sure that the library path is being exported | |
if(NOT WIN32) | |
ament_environment_hooks( | |
"${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}") | |
endif() | |
add_executable(manual_composition | |
src/manual_composition.cpp) | |
target_link_libraries(manual_composition | |
talker_component | |
listener_component | |
server_component | |
client_component) | |
ament_target_dependencies(manual_composition | |
"rclcpp") | |
add_executable(linktime_composition | |
src/linktime_composition.cpp) | |
set(libs | |
talker_component | |
listener_component | |
server_component | |
client_component) | |
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | |
set(libs | |
"-Wl,--no-as-needed" | |
${libs} | |
"-Wl,--as-needed") | |
endif() | |
target_link_libraries(linktime_composition ${libs}) | |
ament_target_dependencies(linktime_composition | |
"class_loader" | |
"rclcpp" | |
"rclcpp_components") | |
add_executable(dlopen_composition | |
src/dlopen_composition.cpp) | |
ament_target_dependencies(dlopen_composition | |
"class_loader" | |
"rclcpp" | |
"rclcpp_components") | |
install(TARGETS | |
talker_component | |
listener_component | |
node_like_listener_component | |
server_component | |
client_component | |
ARCHIVE DESTINATION lib | |
LIBRARY DESTINATION lib | |
RUNTIME DESTINATION bin) | |
install(TARGETS | |
manual_composition | |
linktime_composition | |
dlopen_composition | |
DESTINATION lib/${PROJECT_NAME}) | |
# Install launch files. | |
install(DIRECTORY | |
launch | |
DESTINATION share/${PROJECT_NAME} | |
) | |
ament_package() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment