Start of refactor - remove upstream code and just contain deltas
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(agv_pro_bringup)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
|
||||
install(DIRECTORY
|
||||
launch
|
||||
config
|
||||
DESTINATION share/${PROJECT_NAME}/
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
set(ament_cmake_copyright_FOUND TRUE)
|
||||
set(ament_cmake_cpplint_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
ament_package()
|
||||
@@ -0,0 +1,50 @@
|
||||
-- Copyright 2016 The Cartographer Authors
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
include "map_builder.lua"
|
||||
include "trajectory_builder.lua"
|
||||
|
||||
options = {
|
||||
map_builder = MAP_BUILDER,
|
||||
trajectory_builder = TRAJECTORY_BUILDER,
|
||||
map_frame = "map",
|
||||
tracking_frame = "base_footprint",
|
||||
published_frame = "base_footprint",
|
||||
odom_frame = "odom",
|
||||
provide_odom_frame = true,
|
||||
publish_frame_projected_to_2d = true,
|
||||
use_pose_extrapolator = true,
|
||||
use_odometry = true,
|
||||
use_nav_sat = false,
|
||||
use_landmarks = false,
|
||||
num_laser_scans = 1,
|
||||
num_multi_echo_laser_scans = 0,
|
||||
num_subdivisions_per_laser_scan = 1,
|
||||
num_point_clouds = 0,
|
||||
lookup_transform_timeout_sec = 0.2,
|
||||
submap_publish_period_sec = 0.3,
|
||||
pose_publish_period_sec = 5e-3,
|
||||
trajectory_publish_period_sec = 30e-3,
|
||||
rangefinder_sampling_ratio = 1.,
|
||||
odometry_sampling_ratio = 1.,
|
||||
fixed_frame_pose_sampling_ratio = 1.,
|
||||
imu_sampling_ratio = 1.,
|
||||
landmarks_sampling_ratio = 1.,
|
||||
}
|
||||
|
||||
MAP_BUILDER.use_trajectory_builder_2d = true
|
||||
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 10
|
||||
TRAJECTORY_BUILDER_2D.use_imu_data = false
|
||||
|
||||
return options
|
||||
@@ -0,0 +1,118 @@
|
||||
import os
|
||||
from launch import LaunchDescription
|
||||
from launch.conditions import IfCondition
|
||||
from launch_ros.actions import Node,PushRosNamespace
|
||||
from launch.actions import DeclareLaunchArgument,IncludeLaunchDescription
|
||||
from launch.substitutions import Command,LaunchConfiguration,PythonExpression
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
def include_lidar(pkg_name, launch_file, enable_lidar, lidar_type, expected_type):
|
||||
|
||||
return IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(
|
||||
get_package_share_directory(pkg_name),
|
||||
'launch',
|
||||
launch_file
|
||||
)
|
||||
),
|
||||
condition=IfCondition(
|
||||
PythonExpression([
|
||||
"'", enable_lidar, "' == 'true' and '",
|
||||
lidar_type, "' == '", expected_type, "'"
|
||||
])
|
||||
)
|
||||
)
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
port_name_arg = LaunchConfiguration('port_name')
|
||||
namespace = LaunchConfiguration('namespace')
|
||||
lidar_type = LaunchConfiguration('lidar_type')
|
||||
enable_lidar = LaunchConfiguration('enable_lidar')
|
||||
|
||||
urdf_file = os.path.join(
|
||||
get_package_share_directory('agv_pro_description'),
|
||||
'urdf',
|
||||
'agv_pro.urdf'
|
||||
)
|
||||
|
||||
robot_description_content = Command([
|
||||
'xacro ',
|
||||
urdf_file,
|
||||
' namespace:=',
|
||||
PythonExpression(['"', namespace, '" + "/" if "', namespace, '" != "" else ""']),
|
||||
])
|
||||
|
||||
declare_port_name_arg = DeclareLaunchArgument(
|
||||
'port_name',
|
||||
default_value='/dev/agvpro_controller',
|
||||
description='port name, e.g. /dev/ttyACM0'
|
||||
)
|
||||
|
||||
declare_namespace_arg = DeclareLaunchArgument(
|
||||
'namespace',
|
||||
default_value='',
|
||||
description='Namespace for nodes'
|
||||
)
|
||||
|
||||
declare_enable_lidar_arg = DeclareLaunchArgument(
|
||||
'enable_lidar',
|
||||
default_value='true',
|
||||
description='Whether to launch lidar drivers'
|
||||
)
|
||||
|
||||
declare_lidar_type_arg = DeclareLaunchArgument(
|
||||
'lidar_type',
|
||||
default_value='n10p',
|
||||
description='Lidar type: n10p | mid360 | l2'
|
||||
)
|
||||
|
||||
ns_action = PushRosNamespace(namespace)
|
||||
|
||||
agv_pro_node = Node(
|
||||
package='agv_pro_base',
|
||||
executable='agv_pro_node',
|
||||
name='agv_pro_node',
|
||||
output='screen',
|
||||
parameters=[{
|
||||
'port_name': port_name_arg,
|
||||
'namespace': namespace,
|
||||
}],
|
||||
remappings=[('cmd_vel', '/cmd_vel')]
|
||||
)
|
||||
|
||||
joint_state_pub = Node(
|
||||
package='joint_state_publisher',
|
||||
executable='joint_state_publisher',
|
||||
name='joint_state_publisher'
|
||||
)
|
||||
|
||||
robot_state_pub = Node(
|
||||
package='robot_state_publisher',
|
||||
executable='robot_state_publisher',
|
||||
name='robot_state_publisher',
|
||||
parameters=[{'robot_description': robot_description_content}],
|
||||
output='screen'
|
||||
)
|
||||
|
||||
lidar_launchs = [
|
||||
include_lidar('lslidar_driver', 'lsn10p_launch.py', enable_lidar, lidar_type, 'n10p'),
|
||||
include_lidar('livox_ros_driver2', 'MID360_launch.py',enable_lidar, lidar_type, 'mid360'),
|
||||
include_lidar('unitree_lidar_ros2', 'launch.py', enable_lidar, lidar_type, 'l2'),
|
||||
]
|
||||
|
||||
return LaunchDescription(
|
||||
[
|
||||
declare_port_name_arg,
|
||||
declare_namespace_arg,
|
||||
declare_enable_lidar_arg,
|
||||
declare_lidar_type_arg,
|
||||
ns_action,
|
||||
agv_pro_node,
|
||||
joint_state_pub,
|
||||
robot_state_pub,
|
||||
*lidar_launchs,
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
Copyright 2018 The Cartographer Authors
|
||||
Copyright 2022 Wyca Robotics (for the ros2 conversion)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from launch.actions import Shutdown
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
## ***** Launch arguments *****
|
||||
use_sim_time_arg = DeclareLaunchArgument('use_sim_time', default_value = 'False')
|
||||
|
||||
## ***** File paths ******
|
||||
# AGV-specific cartographer configuration lives in this package so the
|
||||
# upstream cartographer_ros install can stay in its vanilla state.
|
||||
configuration_directory = FindPackageShare('agv_pro_bringup').find('agv_pro_bringup') + '/config'
|
||||
# The RViz config is provided by the (vanilla) upstream cartographer_ros package.
|
||||
rviz_config = FindPackageShare('cartographer_ros').find('cartographer_ros') + '/configuration_files/demo_2d.rviz'
|
||||
|
||||
cartographer_node = Node(
|
||||
package = 'cartographer_ros',
|
||||
executable = 'cartographer_node',
|
||||
parameters = [{'use_sim_time': LaunchConfiguration('use_sim_time')}],
|
||||
arguments = [
|
||||
'-configuration_directory', configuration_directory,
|
||||
'-configuration_basename', 'agvpro_backpack_2d.lua'],
|
||||
remappings = [
|
||||
('echoes', 'horizontal_laser_2d')],
|
||||
output = 'screen'
|
||||
)
|
||||
|
||||
cartographer_occupancy_grid_node = Node(
|
||||
package = 'cartographer_ros',
|
||||
executable = 'cartographer_occupancy_grid_node',
|
||||
parameters = [
|
||||
{'use_sim_time': False},
|
||||
{'resolution': 0.05}],
|
||||
)
|
||||
|
||||
rviz_node = Node(
|
||||
package = 'rviz2',
|
||||
executable = 'rviz2',
|
||||
on_exit = Shutdown(),
|
||||
arguments = ['-d', rviz_config],
|
||||
parameters = [{'use_sim_time': False}],
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
use_sim_time_arg,
|
||||
# Nodes
|
||||
rviz_node,
|
||||
cartographer_node,
|
||||
cartographer_occupancy_grid_node,
|
||||
])
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>agv_pro_bringup</name>
|
||||
<version>1.0.8</version>
|
||||
<description>ROS 2 launch scripts for starting the AGV Pro</description>
|
||||
<maintainer email="weijun.xie@elephantrobotics.com">lanni</maintainer>
|
||||
<license>BSD-3-Clause license</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
<exec_depend>robot_state_publisher</exec_depend>
|
||||
<exec_depend>joint_state_publisher</exec_depend>
|
||||
<exec_depend>rviz2</exec_depend>
|
||||
<exec_depend>agv_pro_description</exec_depend>
|
||||
<exec_depend>agv_pro_base</exec_depend>
|
||||
<exec_depend>cartographer_ros</exec_depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
Reference in New Issue
Block a user