Staging checkin for the simulation migration
This commit is contained in:
@@ -14,7 +14,7 @@ if(BUILD_TESTING)
|
|||||||
ament_lint_auto_find_test_dependencies()
|
ament_lint_auto_find_test_dependencies()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY meshes urdf launch rviz config
|
install(DIRECTORY meshes urdf launch rviz config worlds
|
||||||
DESTINATION share/${PROJECT_NAME}
|
DESTINATION share/${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
controller_manager:
|
|
||||||
ros__parameters:
|
|
||||||
update_rate: 100
|
|
||||||
|
|
||||||
joint_state_broadcaster:
|
|
||||||
type: joint_state_broadcaster/JointStateBroadcaster
|
|
||||||
|
|
||||||
diff_drive_controller:
|
|
||||||
type: diff_drive_controller/DiffDriveController
|
|
||||||
left_wheel_names: ["left_front_wheel_joint", "left_rear_wheel_joint"]
|
|
||||||
right_wheel_names: ["right_front_wheel_joint", "right_rear_wheel_joint"]
|
|
||||||
|
|
||||||
wheel_separation: 0.36
|
|
||||||
wheel_radius: 0.05
|
|
||||||
|
|
||||||
base_frame_id: base_link
|
|
||||||
use_stamped_vel: false
|
|
||||||
publish_rate: 50
|
|
||||||
|
|
||||||
enable_odom_tf: true
|
|
||||||
odom_frame_id: odom
|
|
||||||
pose_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
|
||||||
twist_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
|
||||||
@@ -4,25 +4,36 @@ controller_manager:
|
|||||||
use_sim_time: true # 使用仿真时间
|
use_sim_time: true # 使用仿真时间
|
||||||
|
|
||||||
# 定义关节状态广播器
|
# 定义关节状态广播器
|
||||||
fishbot_joint_state_broadcaster:
|
joint_state_broadcaster:
|
||||||
type: joint_state_broadcaster/JointStateBroadcaster
|
type: joint_state_broadcaster/JointStateBroadcaster
|
||||||
use_sim_time: true
|
|
||||||
|
|
||||||
# 定义全向驱动控制器
|
# 定义麦克纳姆轮驱动控制器
|
||||||
fishbot_omni_drive_controller:
|
mecanum_drive_controller:
|
||||||
type: omni_drive_controller/OmniDriveController
|
type: mecanum_drive_controller/MecanumDriveController
|
||||||
|
|
||||||
# 四轮全向控制器配置
|
# 麦克纳姆四轮驱动控制器配置
|
||||||
fishbot_omni_drive_controller:
|
mecanum_drive_controller:
|
||||||
ros__parameters:
|
ros__parameters:
|
||||||
front_left_wheel_joint: front_left_wheel_joint
|
reference_timeout: 0.5
|
||||||
front_right_wheel_joint: front_right_wheel_joint
|
|
||||||
rear_left_wheel_joint: rear_left_wheel_joint
|
# 命令关节 (velocity command interface)
|
||||||
rear_right_wheel_joint: rear_right_wheel_joint
|
front_left_wheel_command_joint_name: left_front_wheel_joint
|
||||||
wheel_separation: 0.36 # 轮距
|
front_right_wheel_command_joint_name: right_front_wheel_joint
|
||||||
wheel_diameter: 0.1 # 轮子直径
|
rear_left_wheel_command_joint_name: left_rear_wheel_joint
|
||||||
publish_rate: 50.0 # 发布频率
|
rear_right_wheel_command_joint_name: right_rear_wheel_joint
|
||||||
odom_frame_id: odom
|
|
||||||
|
kinematics:
|
||||||
|
base_frame_offset:
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
theta: 0.0
|
||||||
|
wheels_radius: 0.05 # 轮子半径
|
||||||
|
# lx + ly : 底盘中心到轮子在 X 与 Y 方向投影之和
|
||||||
|
sum_of_robot_center_projection_on_X_Y_axis: 0.35
|
||||||
|
|
||||||
base_frame_id: base_link
|
base_frame_id: base_link
|
||||||
|
odom_frame_id: odom
|
||||||
|
enable_odom_tf: true
|
||||||
|
|
||||||
pose_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
pose_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
||||||
twist_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
twist_covariance_diagonal: [0.001, 0.001, 99999.0, 99999.0, 99999.0, 0.03]
|
||||||
|
|||||||
@@ -1,65 +1,145 @@
|
|||||||
import os
|
import os
|
||||||
from launch import LaunchDescription
|
from launch import LaunchDescription
|
||||||
from launch.actions import IncludeLaunchDescription
|
from launch.actions import (
|
||||||
|
IncludeLaunchDescription,
|
||||||
|
DeclareLaunchArgument,
|
||||||
|
RegisterEventHandler,
|
||||||
|
TimerAction,
|
||||||
|
)
|
||||||
|
from launch.conditions import IfCondition
|
||||||
|
from launch.event_handlers import OnProcessExit
|
||||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||||
from launch.substitutions import Command
|
from launch.substitutions import Command, LaunchConfiguration, PythonExpression
|
||||||
from launch_ros.actions import Node
|
from launch_ros.actions import Node
|
||||||
from launch_ros.parameter_descriptions import ParameterValue
|
from launch_ros.parameter_descriptions import ParameterValue
|
||||||
from ament_index_python.packages import get_package_share_directory
|
from ament_index_python.packages import get_package_share_directory
|
||||||
|
|
||||||
|
|
||||||
def generate_launch_description():
|
def generate_launch_description():
|
||||||
pkg_name = 'agv_pro_gazebo'
|
pkg_gazebo = get_package_share_directory('agv_pro_gazebo')
|
||||||
pkg_dir = get_package_share_directory(pkg_name)
|
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
|
||||||
xacro_file = os.path.join(pkg_dir, 'urdf', 'agv_pro.xacro')
|
|
||||||
world_file = os.path.join(pkg_dir, 'worlds', 'empty.world')
|
|
||||||
rviz_config = os.path.join(pkg_dir, 'rviz', 'agvpro_display.rviz')
|
|
||||||
|
|
||||||
robot_description_content = ParameterValue(
|
xacro_file = os.path.join(pkg_gazebo, 'urdf', 'agv_pro.xacro')
|
||||||
Command(['xacro ', xacro_file]),
|
world_file = os.path.join(pkg_gazebo, 'worlds', 'empty.world')
|
||||||
value_type=str
|
rviz_config = os.path.join(pkg_gazebo, 'rviz', 'agvpro_display.rviz')
|
||||||
)
|
|
||||||
robot_description = {'robot_description': robot_description_content}
|
|
||||||
|
|
||||||
return LaunchDescription([
|
use_sim_time = LaunchConfiguration('use_sim_time')
|
||||||
# Launch Gazebo
|
use_rviz = LaunchConfiguration('use_rviz')
|
||||||
IncludeLaunchDescription(
|
headless = LaunchConfiguration('headless')
|
||||||
|
|
||||||
|
robot_description = {
|
||||||
|
'robot_description': ParameterValue(
|
||||||
|
Command(['xacro ', xacro_file]), value_type=str
|
||||||
|
),
|
||||||
|
'use_sim_time': use_sim_time,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start gz-sim (Gazebo Harmonic) with the world.
|
||||||
|
# '-s' (server only) is added when headless:=true.
|
||||||
|
gz_args = PythonExpression([
|
||||||
|
"'-r -v4 -s ' + ", repr(world_file),
|
||||||
|
" if '", headless, "' == 'true' ",
|
||||||
|
"else '-r -v4 ' + ", repr(world_file),
|
||||||
|
])
|
||||||
|
gz_sim = IncludeLaunchDescription(
|
||||||
PythonLaunchDescriptionSource(
|
PythonLaunchDescriptionSource(
|
||||||
os.path.join(get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')
|
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')
|
||||||
),
|
|
||||||
launch_arguments={'world': world_file}.items()
|
|
||||||
),
|
),
|
||||||
|
launch_arguments={'gz_args': gz_args}.items(),
|
||||||
|
)
|
||||||
|
|
||||||
# Spawn robot into Gazebo
|
# Publish the robot description (also consumed by gz_ros2_control)
|
||||||
Node(
|
robot_state_publisher = Node(
|
||||||
package='gazebo_ros',
|
|
||||||
executable='spawn_entity.py',
|
|
||||||
arguments=['-topic', 'robot_description',
|
|
||||||
'-entity', 'agv_pro'],
|
|
||||||
output='screen'
|
|
||||||
),
|
|
||||||
|
|
||||||
# State publisher
|
|
||||||
Node(
|
|
||||||
package='robot_state_publisher',
|
package='robot_state_publisher',
|
||||||
executable='robot_state_publisher',
|
executable='robot_state_publisher',
|
||||||
name='robot_state_publisher',
|
name='robot_state_publisher',
|
||||||
output='screen',
|
output='screen',
|
||||||
parameters=[robot_description]
|
parameters=[robot_description],
|
||||||
),
|
)
|
||||||
|
|
||||||
Node(
|
# Spawn the robot into gz-sim from the robot_description topic.
|
||||||
package='joint_state_publisher',
|
# Delayed so robot_state_publisher has latched /robot_description before the
|
||||||
executable='joint_state_publisher',
|
# gz_ros2_control plugin (loaded on spawn) reads it — avoids a startup race
|
||||||
name='joint_state_publisher',
|
# where the in-sim controller_manager sees no <ros2_control> tag.
|
||||||
|
spawn_entity = Node(
|
||||||
|
package='ros_gz_sim',
|
||||||
|
executable='create',
|
||||||
|
arguments=['-topic', 'robot_description', '-name', 'agv_pro', '-z', '0.1'],
|
||||||
output='screen',
|
output='screen',
|
||||||
),
|
)
|
||||||
|
delayed_spawn = TimerAction(period=3.0, actions=[spawn_entity])
|
||||||
|
|
||||||
# Optional: RViz
|
# Bridge the simulation clock so ROS nodes get /clock
|
||||||
Node(
|
clock_bridge = Node(
|
||||||
|
package='ros_gz_bridge',
|
||||||
|
executable='parameter_bridge',
|
||||||
|
arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'],
|
||||||
|
output='screen',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Controllers (controller_manager runs inside the gz_ros2_control plugin)
|
||||||
|
joint_state_broadcaster_spawner = Node(
|
||||||
|
package='controller_manager',
|
||||||
|
executable='spawner',
|
||||||
|
arguments=[
|
||||||
|
'joint_state_broadcaster',
|
||||||
|
'--controller-manager', '/controller_manager',
|
||||||
|
],
|
||||||
|
output='screen',
|
||||||
|
)
|
||||||
|
|
||||||
|
mecanum_drive_controller_spawner = Node(
|
||||||
|
package='controller_manager',
|
||||||
|
executable='spawner',
|
||||||
|
arguments=[
|
||||||
|
'mecanum_drive_controller',
|
||||||
|
'--controller-manager', '/controller_manager',
|
||||||
|
],
|
||||||
|
output='screen',
|
||||||
|
)
|
||||||
|
|
||||||
|
rviz = Node(
|
||||||
package='rviz2',
|
package='rviz2',
|
||||||
executable='rviz2',
|
executable='rviz2',
|
||||||
name='rviz2',
|
name='rviz2',
|
||||||
output='screen',
|
|
||||||
arguments=['-d', rviz_config],
|
arguments=['-d', rviz_config],
|
||||||
|
parameters=[{'use_sim_time': use_sim_time}],
|
||||||
|
condition=IfCondition(use_rviz),
|
||||||
|
output='screen',
|
||||||
|
)
|
||||||
|
|
||||||
|
return LaunchDescription([
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
'use_sim_time',
|
||||||
|
default_value='true',
|
||||||
|
description='Use the Gazebo simulation clock',
|
||||||
),
|
),
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
'use_rviz',
|
||||||
|
default_value='true',
|
||||||
|
description='Launch RViz2',
|
||||||
|
),
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
'headless',
|
||||||
|
default_value='false',
|
||||||
|
description='Run gz-sim without the GUI (server only)',
|
||||||
|
),
|
||||||
|
gz_sim,
|
||||||
|
robot_state_publisher,
|
||||||
|
clock_bridge,
|
||||||
|
delayed_spawn,
|
||||||
|
# Load controllers only after the robot has been spawned
|
||||||
|
RegisterEventHandler(
|
||||||
|
OnProcessExit(
|
||||||
|
target_action=spawn_entity,
|
||||||
|
on_exit=[joint_state_broadcaster_spawner],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
RegisterEventHandler(
|
||||||
|
OnProcessExit(
|
||||||
|
target_action=joint_state_broadcaster_spawner,
|
||||||
|
on_exit=[mecanum_drive_controller_spawner],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
rviz,
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
import os
|
|
||||||
from launch import LaunchDescription
|
|
||||||
from launch.actions import IncludeLaunchDescription, ExecuteProcess
|
|
||||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
|
||||||
from launch.substitutions import Command, LaunchConfiguration, PathJoinSubstitution
|
|
||||||
from launch_ros.actions import Node
|
|
||||||
from ament_index_python.packages import get_package_share_directory
|
|
||||||
|
|
||||||
def generate_launch_description():
|
|
||||||
pkg_name = 'agv_pro_description'
|
|
||||||
|
|
||||||
# Paths
|
|
||||||
pkg_dir = get_package_share_directory(pkg_name)
|
|
||||||
xacro_file = os.path.join(pkg_dir, 'urdf', 'agv_pro.xacro')
|
|
||||||
world_file = os.path.join(pkg_dir, 'worlds', 'empty.world') # 创建一个空 world 即可
|
|
||||||
rviz_config = os.path.join(pkg_dir, 'rviz', 'agvpro_display.rviz')
|
|
||||||
|
|
||||||
robot_description_content = Command(['xacro ', xacro_file])
|
|
||||||
robot_description = {'robot_description': robot_description_content}
|
|
||||||
|
|
||||||
return LaunchDescription([
|
|
||||||
|
|
||||||
# Start Gazebo with empty world
|
|
||||||
IncludeLaunchDescription(
|
|
||||||
PythonLaunchDescriptionSource(
|
|
||||||
[os.path.join(get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]
|
|
||||||
),
|
|
||||||
launch_arguments={'world': world_file}.items()
|
|
||||||
),
|
|
||||||
|
|
||||||
# Spawn robot into Gazebo
|
|
||||||
Node(
|
|
||||||
package='gazebo_ros',
|
|
||||||
executable='spawn_entity.py',
|
|
||||||
arguments=['-topic', 'robot_description',
|
|
||||||
'-entity', 'agv_pro'],
|
|
||||||
output='screen'
|
|
||||||
),
|
|
||||||
|
|
||||||
# Robot state publisher
|
|
||||||
Node(
|
|
||||||
package='robot_state_publisher',
|
|
||||||
executable='robot_state_publisher',
|
|
||||||
name='robot_state_publisher',
|
|
||||||
output='screen',
|
|
||||||
parameters=[robot_description]
|
|
||||||
),
|
|
||||||
|
|
||||||
# Optionally publish joint states if not using controllers
|
|
||||||
Node(
|
|
||||||
package='joint_state_publisher',
|
|
||||||
executable='joint_state_publisher',
|
|
||||||
name='joint_state_publisher',
|
|
||||||
output='screen',
|
|
||||||
),
|
|
||||||
Node(
|
|
||||||
package='controller_manager',
|
|
||||||
executable='spawner',
|
|
||||||
arguments=['joint_state_broadcaster'],
|
|
||||||
output='screen',
|
|
||||||
),
|
|
||||||
|
|
||||||
# RViz (optional, visualize TF & model)
|
|
||||||
Node(
|
|
||||||
package='rviz2',
|
|
||||||
executable='rviz2',
|
|
||||||
name='rviz2',
|
|
||||||
output='screen',
|
|
||||||
arguments=['-d', rviz_config],
|
|
||||||
),
|
|
||||||
])
|
|
||||||
@@ -2,6 +2,7 @@ import os
|
|||||||
from launch import LaunchDescription
|
from launch import LaunchDescription
|
||||||
from launch_ros.actions import Node
|
from launch_ros.actions import Node
|
||||||
|
|
||||||
|
|
||||||
def generate_launch_description():
|
def generate_launch_description():
|
||||||
return LaunchDescription([
|
return LaunchDescription([
|
||||||
Node(
|
Node(
|
||||||
@@ -10,8 +11,14 @@ def generate_launch_description():
|
|||||||
name='teleop_keyboard',
|
name='teleop_keyboard',
|
||||||
output='screen',
|
output='screen',
|
||||||
prefix='xterm -e', # 或 'gnome-terminal --' 替换为你的终端命令
|
prefix='xterm -e', # 或 'gnome-terminal --' 替换为你的终端命令
|
||||||
|
# mecanum_drive_controller expects a stamped reference; teleop must
|
||||||
|
# publish geometry_msgs/TwistStamped with a fresh timestamp.
|
||||||
|
parameters=[{
|
||||||
|
'stamped': True,
|
||||||
|
'frame_id': 'base_link',
|
||||||
|
}],
|
||||||
remappings=[
|
remappings=[
|
||||||
('/cmd_vel', '/diff_drive_controller/cmd_vel_unstamped')
|
('/cmd_vel', '/mecanum_drive_controller/reference'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -12,8 +12,12 @@
|
|||||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||||
<buildtool_depend>xacro</buildtool_depend>
|
<buildtool_depend>xacro</buildtool_depend>
|
||||||
|
|
||||||
<!-- Build dependencies -->
|
<!-- Runtime dependencies -->
|
||||||
<depend>gazebo_ros_pkgs</depend>
|
<!-- Gazebo (gz-sim Harmonic) integration for ROS 2 Jazzy -->
|
||||||
|
<exec_depend>ros_gz_sim</exec_depend>
|
||||||
|
<exec_depend>ros_gz_bridge</exec_depend>
|
||||||
|
<depend>gz_ros2_control</depend>
|
||||||
|
|
||||||
<depend>robot_state_publisher</depend>
|
<depend>robot_state_publisher</depend>
|
||||||
<depend>joint_state_publisher</depend>
|
<depend>joint_state_publisher</depend>
|
||||||
<depend>geometry_msgs</depend>
|
<depend>geometry_msgs</depend>
|
||||||
@@ -24,9 +28,8 @@
|
|||||||
<depend>ros2_control</depend>
|
<depend>ros2_control</depend>
|
||||||
<depend>controller_manager</depend>
|
<depend>controller_manager</depend>
|
||||||
<depend>joint_state_broadcaster</depend>
|
<depend>joint_state_broadcaster</depend>
|
||||||
<depend>diff_drive_controller</depend>
|
<depend>mecanum_drive_controller</depend>
|
||||||
<depend>teleop_twist_keyboard</depend>
|
<depend>teleop_twist_keyboard</depend>
|
||||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
|
||||||
|
|
||||||
<test_depend>ament_lint_auto</test_depend>
|
<test_depend>ament_lint_auto</test_depend>
|
||||||
<test_depend>ament_lint_common</test_depend>
|
<test_depend>ament_lint_common</test_depend>
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="agv_pro">
|
|
||||||
|
|
||||||
<!-- Gazebo-specific properties -->
|
|
||||||
<xacro:property name="wheel_damping" value="0.1"/>
|
|
||||||
<xacro:property name="wheel_axis" value="0 1 0"/>
|
|
||||||
|
|
||||||
<!-- Base footprint -->
|
|
||||||
<link name="base_footprint"/>
|
|
||||||
|
|
||||||
<joint name="base_joint" type="fixed">
|
|
||||||
<parent link="base_footprint"/>
|
|
||||||
<child link="base_link" />
|
|
||||||
<origin xyz="0 0 0.020" rpy="0 0 0"/>
|
|
||||||
</joint>
|
|
||||||
|
|
||||||
<link name="base_link">
|
|
||||||
<inertial>
|
|
||||||
<origin xyz="-0.0076254 -0.00023134 0.06693" rpy="0 0 0" />
|
|
||||||
<mass value="19.236" />
|
|
||||||
<inertia ixx="0.14436" ixy="0.0012037" ixz="0.0019458" iyy="0.24191" iyz="0.0044629" izz="0.33755" />
|
|
||||||
</inertial>
|
|
||||||
<visual>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="file://$(find agv_pro_description)/meshes/base_link.stl" />
|
|
||||||
</geometry>
|
|
||||||
<material name="">
|
|
||||||
<color rgba="1 1 1 1" />
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="file://$(find agv_pro_description)/meshes/base_link.stl" />
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<!-- Gazebo plugin for control -->
|
|
||||||
<gazebo>
|
|
||||||
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so"/>
|
|
||||||
</gazebo>
|
|
||||||
|
|
||||||
<gazebo reference="base_link">
|
|
||||||
<material>Gazebo/White</material>
|
|
||||||
<mu1>1.0</mu1>
|
|
||||||
<mu2>1.0</mu2>
|
|
||||||
<kp>100000.0</kp>
|
|
||||||
<kd>1.0</kd>
|
|
||||||
</gazebo>
|
|
||||||
|
|
||||||
<!-- Include wheel macros -->
|
|
||||||
<xacro:include filename="$(find agv_pro_description)/urdf/parts/wheel_macro.xacro"/>
|
|
||||||
<xacro:include filename="$(find agv_pro_description)/urdf/parts/gazebo_control_plugin.xacro"/>
|
|
||||||
<!-- Add all four wheels using macro -->
|
|
||||||
<xacro:wheel name="right_rear_wheel" mesh="file://$(find agv_pro_description)/meshes/wheel_rb_link.stl" origin_xyz="-0.1718 -0.1799 0.05188" origin_rpy="0 0 0" mass="0.21659" ixx="0.00051181" ixy="2.1577E-08" ixz="2.538E-07" iyy="0.00097519" iyz="-2.3635E-07" izz="0.00051178"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="right_front_wheel" mesh="file://$(find agv_pro_description)/meshes/wheel_rf_link.stl" origin_xyz="-0.17181 0.1799 0.051884" origin_rpy="0 0 0" mass="0.21659" ixx="0.00051181" ixy="2.1577E-08" ixz="2.538E-07" iyy="0.00097519" iyz="-2.3635E-07" izz="0.00051178"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="left_front_wheel" mesh="file://$(find agv_pro_description)/meshes/wheel_lf_link.stl" origin_xyz="0.17128 0.1799 0.052" origin_rpy="0 0 0" mass="0.3015" ixx="0.00052475" ixy="-2.2533E-07" ixz="-4.1904E-07" iyy="0.00099948" iyz="7.5332E-08" izz="0.00052362"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="left_rear_wheel" mesh="file://$(find agv_pro_description)/meshes/wheel_lb_link.stl" origin_xyz="0.17128 -0.1799 0.052" origin_rpy="0 0 0" mass="0.29613" ixx="0.00051227" ixy="-2.0628E-07" ixz="-4.9074E-07" iyy="0.0009752" iyz="1.173E-07" izz="0.00051131"/>
|
|
||||||
|
|
||||||
<!-- Lidar -->
|
|
||||||
<link name="laser_link">
|
|
||||||
<inertial>
|
|
||||||
<origin xyz="-0.0035142 -2.8248E-05 0.0010013" rpy="0 0 0" />
|
|
||||||
<mass value="0.049095" />
|
|
||||||
<inertia ixx="2.0572E-05" ixy="8.5013E-08" ixz="2.0871E-07" iyy="2.0483E-05" iyz="-4.2154E-09" izz="3.4612E-05" />
|
|
||||||
</inertial>
|
|
||||||
<visual>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="file://$(find agv_pro_description)/meshes/laser_link.stl" />
|
|
||||||
</geometry>
|
|
||||||
<material name="">
|
|
||||||
<color rgba="1 1 1 1" />
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="file://$(find agv_pro_description)/meshes/laser_link.stl" />
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<joint name="lidar_joint" type="fixed">
|
|
||||||
<origin xyz="0.17891 0 0.20928" rpy="0 0 0" />
|
|
||||||
<parent link="base_link" />
|
|
||||||
<child link="laser_link" />
|
|
||||||
</joint>
|
|
||||||
|
|
||||||
<!-- ros2_control tag -->
|
|
||||||
<ros2_control name="AGVHardware" type="system">
|
|
||||||
<hardware>
|
|
||||||
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
|
|
||||||
</hardware>
|
|
||||||
|
|
||||||
<joint name="right_rear_wheel_joint">
|
|
||||||
<command_interface name="velocity"/>
|
|
||||||
<state_interface name="position"/>
|
|
||||||
<state_interface name="velocity"/>
|
|
||||||
</joint>
|
|
||||||
<joint name="right_front_wheel_joint">
|
|
||||||
<command_interface name="velocity"/>
|
|
||||||
<state_interface name="position"/>
|
|
||||||
<state_interface name="velocity"/>
|
|
||||||
</joint>
|
|
||||||
<joint name="left_front_wheel_joint">
|
|
||||||
<command_interface name="velocity"/>
|
|
||||||
<state_interface name="position"/>
|
|
||||||
<state_interface name="velocity"/>
|
|
||||||
</joint>
|
|
||||||
<joint name="left_rear_wheel_joint">
|
|
||||||
<command_interface name="velocity"/>
|
|
||||||
<state_interface name="position"/>
|
|
||||||
<state_interface name="velocity"/>
|
|
||||||
</joint>
|
|
||||||
</ros2_control>
|
|
||||||
|
|
||||||
</robot>
|
|
||||||
@@ -85,8 +85,6 @@
|
|||||||
</joint>
|
</joint>
|
||||||
|
|
||||||
<!-- Include ros2_controller.xacro to define controllers -->
|
<!-- Include ros2_controller.xacro to define controllers -->
|
||||||
<xacro:include filename="$(find agv_pro_gazebo)/urdf/parts/gazebo_control_plugin.xacro"/>
|
|
||||||
<xacro:include filename="$(find agv_pro_gazebo)/urdf/ros2_controller.xacro"/>
|
<xacro:include filename="$(find agv_pro_gazebo)/urdf/ros2_controller.xacro"/>
|
||||||
<xacro:ros2_controller/>
|
<xacro:ros2_controller/>
|
||||||
<xacro:gazebo_control_plugin/>
|
|
||||||
</robot>
|
</robot>
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="agv_pro">
|
|
||||||
|
|
||||||
<xacro:property name="wheel_axis" value="0 1 0"/>
|
|
||||||
<xacro:property name="wheel_damping" value="0.1"/>
|
|
||||||
|
|
||||||
<!-- Macro: wheel with Gazebo plugin -->
|
|
||||||
<xacro:macro name="wheel" params="name mesh origin_xyz origin_rpy mass ixx ixy ixz iyy iyz izz">
|
|
||||||
<link name="${name}_link">
|
|
||||||
<inertial>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<mass value="${mass}" />
|
|
||||||
<inertia ixx="${ixx}" ixy="${ixy}" ixz="${ixz}" iyy="${iyy}" iyz="${iyz}" izz="${izz}" />
|
|
||||||
</inertial>
|
|
||||||
<visual>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="${mesh}" />
|
|
||||||
</geometry>
|
|
||||||
<material name=""><color rgba="1 1 1 1"/></material>
|
|
||||||
</visual>
|
|
||||||
<collision>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="${mesh}" />
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
<joint name="${name}_joint" type="continuous">
|
|
||||||
<origin xyz="${origin_xyz}" rpy="${origin_rpy}"/>
|
|
||||||
<parent link="base_link"/>
|
|
||||||
<child link="${name}_link"/>
|
|
||||||
<axis xyz="${wheel_axis}"/>
|
|
||||||
<dynamics damping="${wheel_damping}"/>
|
|
||||||
</joint>
|
|
||||||
|
|
||||||
<transmission name="${name}_trans">
|
|
||||||
<type>transmission_interface/SimpleTransmission</type>
|
|
||||||
<actuator name="${name}_motor">
|
|
||||||
<mechanicalReduction>1</mechanicalReduction>
|
|
||||||
</actuator>
|
|
||||||
<joint name="${name}_joint">
|
|
||||||
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
|
|
||||||
</joint>
|
|
||||||
</transmission>
|
|
||||||
|
|
||||||
<gazebo reference="${name}_link">
|
|
||||||
<mu1>0.8</mu1>
|
|
||||||
<mu2>0.8</mu2>
|
|
||||||
<kp>100000.0</kp>
|
|
||||||
<kd>1.0</kd>
|
|
||||||
<material>Gazebo/Grey</material>
|
|
||||||
</gazebo>
|
|
||||||
</xacro:macro>
|
|
||||||
|
|
||||||
<!-- Base links -->
|
|
||||||
<link name="base_footprint"/>
|
|
||||||
|
|
||||||
<joint name="base_joint" type="fixed">
|
|
||||||
<parent link="base_footprint"/>
|
|
||||||
<child link="base_link"/>
|
|
||||||
<origin xyz="0 0 0.020" rpy="0 0 0"/>
|
|
||||||
</joint>
|
|
||||||
|
|
||||||
<link name="base_link">
|
|
||||||
<inertial>
|
|
||||||
<origin xyz="-0.0076254 -0.00023134 0.06693" rpy="0 0 0" />
|
|
||||||
<mass value="19.236" />
|
|
||||||
<inertia ixx="0.14436" ixy="0.0012037" ixz="0.0019458"
|
|
||||||
iyy="0.24191" iyz="0.0044629" izz="0.33755"/>
|
|
||||||
</inertial>
|
|
||||||
<visual>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="package://agv_pro_description/meshes/base_link.stl"/>
|
|
||||||
</geometry>
|
|
||||||
</visual>
|
|
||||||
<collision>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="package://agv_pro_description/meshes/base_link.stl"/>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<!-- Gazebo plugin for ros2_control -->
|
|
||||||
<gazebo>
|
|
||||||
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so"/>
|
|
||||||
</gazebo>
|
|
||||||
|
|
||||||
<!-- Wheels -->
|
|
||||||
<xacro:wheel name="right_rear_wheel"
|
|
||||||
mesh="package://agv_pro_description/meshes/wheel_rb_link.stl"
|
|
||||||
origin_xyz="-0.1718 -0.1799 0.05188" origin_rpy="0 0 0"
|
|
||||||
mass="0.21659" ixx="0.00051181" ixy="2.1577E-08" ixz="2.538E-07"
|
|
||||||
iyy="0.00097519" iyz="-2.3635E-07" izz="0.00051178"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="right_front_wheel"
|
|
||||||
mesh="package://agv_pro_description/meshes/wheel_rf_link.stl"
|
|
||||||
origin_xyz="-0.17181 0.1799 0.051884" origin_rpy="0 0 0"
|
|
||||||
mass="0.21659" ixx="0.00051181" ixy="2.1577E-08" ixz="2.538E-07"
|
|
||||||
iyy="0.00097519" iyz="-2.3635E-07" izz="0.00051178"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="left_front_wheel"
|
|
||||||
mesh="package://agv_pro_description/meshes/wheel_lf_link.stl"
|
|
||||||
origin_xyz="0.17128 0.1799 0.052" origin_rpy="0 0 0"
|
|
||||||
mass="0.3015" ixx="0.00052475" ixy="-2.2533E-07" ixz="-4.1904E-07"
|
|
||||||
iyy="0.00099948" iyz="7.5332E-08" izz="0.00052362"/>
|
|
||||||
|
|
||||||
<xacro:wheel name="left_rear_wheel"
|
|
||||||
mesh="package://agv_pro_description/meshes/wheel_lb_link.stl"
|
|
||||||
origin_xyz="0.17128 -0.1799 0.052" origin_rpy="0 0 0"
|
|
||||||
mass="0.29613" ixx="0.00051227" ixy="-2.0628E-07" ixz="-4.9074E-07"
|
|
||||||
iyy="0.0009752" iyz="1.173E-07" izz="0.00051131"/>
|
|
||||||
|
|
||||||
<!-- Lidar -->
|
|
||||||
<link name="laser_link">
|
|
||||||
<inertial>
|
|
||||||
<origin xyz="-0.0035142 -2.8248E-05 0.0010013" rpy="0 0 0"/>
|
|
||||||
<mass value="0.049095"/>
|
|
||||||
<inertia ixx="2.0572E-05" ixy="8.5013E-08" ixz="2.0871E-07"
|
|
||||||
iyy="2.0483E-05" iyz="-4.2154E-09" izz="3.4612E-05"/>
|
|
||||||
</inertial>
|
|
||||||
<visual>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="package://agv_pro_description/meshes/laser_link.stl"/>
|
|
||||||
</geometry>
|
|
||||||
</visual>
|
|
||||||
<collision>
|
|
||||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
|
||||||
<geometry>
|
|
||||||
<mesh filename="package://agv_pro_description/meshes/laser_link.stl"/>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<joint name="lidar_joint" type="fixed">
|
|
||||||
<origin xyz="0.17891 0 0.20928" rpy="0 0 0"/>
|
|
||||||
<parent link="base_link"/>
|
|
||||||
<child link="laser_link"/>
|
|
||||||
</joint>
|
|
||||||
|
|
||||||
</robot>
|
|
||||||
@@ -51,7 +51,13 @@
|
|||||||
<mu2>0.8</mu2>
|
<mu2>0.8</mu2>
|
||||||
<kp>100000.0</kp>
|
<kp>100000.0</kp>
|
||||||
<kd>1.0</kd>
|
<kd>1.0</kd>
|
||||||
<material>Gazebo/Black</material>
|
<visual>
|
||||||
|
<material>
|
||||||
|
<ambient>0.1 0.1 0.1 1</ambient>
|
||||||
|
<diffuse>0.1 0.1 0.1 1</diffuse>
|
||||||
|
<specular>0.1 0.1 0.1 1</specular>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
</gazebo>
|
</gazebo>
|
||||||
|
|
||||||
</xacro:macro>
|
</xacro:macro>
|
||||||
|
|||||||
@@ -1,55 +1,42 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
||||||
<xacro:macro name="ros2_controller">
|
<xacro:macro name="ros2_controller">
|
||||||
<ros2_control name="FishBotGazeboSystem" type="system">
|
<!-- ros2_control hardware description for gz-sim (Gazebo Harmonic) -->
|
||||||
|
<ros2_control name="GazeboSimSystem" type="system">
|
||||||
<hardware>
|
<hardware>
|
||||||
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
|
<plugin>gz_ros2_control/GazeboSimSystem</plugin>
|
||||||
</hardware>
|
</hardware>
|
||||||
|
|
||||||
<!-- 配置所有轮子的控制接口 -->
|
<joint name="left_front_wheel_joint">
|
||||||
<joint name="front_left_wheel_joint">
|
|
||||||
<command_interface name="position" />
|
|
||||||
<command_interface name="velocity"/>
|
<command_interface name="velocity"/>
|
||||||
<command_interface name="effort" />
|
|
||||||
<state_interface name="position"/>
|
<state_interface name="position"/>
|
||||||
<state_interface name="velocity"/>
|
<state_interface name="velocity"/>
|
||||||
<state_interface name="effort" />
|
|
||||||
</joint>
|
</joint>
|
||||||
|
|
||||||
<joint name="front_right_wheel_joint">
|
<joint name="right_front_wheel_joint">
|
||||||
<command_interface name="position" />
|
|
||||||
<command_interface name="velocity"/>
|
<command_interface name="velocity"/>
|
||||||
<command_interface name="effort" />
|
|
||||||
<state_interface name="position"/>
|
<state_interface name="position"/>
|
||||||
<state_interface name="velocity"/>
|
<state_interface name="velocity"/>
|
||||||
<state_interface name="effort" />
|
|
||||||
</joint>
|
</joint>
|
||||||
|
|
||||||
<joint name="rear_left_wheel_joint">
|
<joint name="left_rear_wheel_joint">
|
||||||
<command_interface name="position" />
|
|
||||||
<command_interface name="velocity"/>
|
<command_interface name="velocity"/>
|
||||||
<command_interface name="effort" />
|
|
||||||
<state_interface name="position"/>
|
<state_interface name="position"/>
|
||||||
<state_interface name="velocity"/>
|
<state_interface name="velocity"/>
|
||||||
<state_interface name="effort" />
|
|
||||||
</joint>
|
</joint>
|
||||||
|
|
||||||
<joint name="rear_right_wheel_joint">
|
<joint name="right_rear_wheel_joint">
|
||||||
<command_interface name="position" />
|
|
||||||
<command_interface name="velocity"/>
|
<command_interface name="velocity"/>
|
||||||
<command_interface name="effort" />
|
|
||||||
<state_interface name="position"/>
|
<state_interface name="position"/>
|
||||||
<state_interface name="velocity"/>
|
<state_interface name="velocity"/>
|
||||||
<state_interface name="effort" />
|
|
||||||
</joint>
|
</joint>
|
||||||
</ros2_control>
|
</ros2_control>
|
||||||
|
|
||||||
|
<!-- gz_ros2_control system plugin: hosts the controller_manager inside gz-sim -->
|
||||||
<gazebo>
|
<gazebo>
|
||||||
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
|
<plugin filename="gz_ros2_control-system"
|
||||||
|
name="gz_ros2_control::GazeboSimROS2ControlPlugin">
|
||||||
<parameters>$(find agv_pro_gazebo)/config/agv_control.yaml</parameters>
|
<parameters>$(find agv_pro_gazebo)/config/agv_control.yaml</parameters>
|
||||||
<ros>
|
|
||||||
<remapping>/omni_drive_controller/cmd_vel:=/cmd_vel</remapping>
|
|
||||||
<remapping>/omni_drive_controller/odom:=/odom</remapping>
|
|
||||||
</ros>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</gazebo>
|
</gazebo>
|
||||||
</xacro:macro>
|
</xacro:macro>
|
||||||
|
|||||||
@@ -1,11 +1,69 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<sdf version="1.6">
|
<sdf version="1.10">
|
||||||
<world name="empty_world">
|
<world name="empty_world">
|
||||||
<include>
|
|
||||||
<uri>model://ground_plane</uri>
|
<!-- Required gz-sim (Gazebo Harmonic) system plugins -->
|
||||||
</include>
|
<plugin filename="gz-sim-physics-system"
|
||||||
<include>
|
name="gz::sim::systems::Physics">
|
||||||
<uri>model://sun</uri>
|
</plugin>
|
||||||
</include>
|
<plugin filename="gz-sim-user-commands-system"
|
||||||
|
name="gz::sim::systems::UserCommands">
|
||||||
|
</plugin>
|
||||||
|
<plugin filename="gz-sim-scene-broadcaster-system"
|
||||||
|
name="gz::sim::systems::SceneBroadcaster">
|
||||||
|
</plugin>
|
||||||
|
<plugin filename="gz-sim-sensors-system"
|
||||||
|
name="gz::sim::systems::Sensors">
|
||||||
|
<render_engine>ogre2</render_engine>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<physics name="1ms" type="ignored">
|
||||||
|
<max_step_size>0.001</max_step_size>
|
||||||
|
<real_time_factor>1.0</real_time_factor>
|
||||||
|
</physics>
|
||||||
|
|
||||||
|
<!-- Sun -->
|
||||||
|
<light type="directional" name="sun">
|
||||||
|
<cast_shadows>true</cast_shadows>
|
||||||
|
<pose>0 0 10 0 0 0</pose>
|
||||||
|
<diffuse>0.8 0.8 0.8 1</diffuse>
|
||||||
|
<specular>0.2 0.2 0.2 1</specular>
|
||||||
|
<attenuation>
|
||||||
|
<range>1000</range>
|
||||||
|
<constant>0.9</constant>
|
||||||
|
<linear>0.01</linear>
|
||||||
|
<quadratic>0.001</quadratic>
|
||||||
|
</attenuation>
|
||||||
|
<direction>-0.5 0.1 -0.9</direction>
|
||||||
|
</light>
|
||||||
|
|
||||||
|
<!-- Ground plane -->
|
||||||
|
<model name="ground_plane">
|
||||||
|
<static>true</static>
|
||||||
|
<link name="link">
|
||||||
|
<collision name="collision">
|
||||||
|
<geometry>
|
||||||
|
<plane>
|
||||||
|
<normal>0 0 1</normal>
|
||||||
|
<size>100 100</size>
|
||||||
|
</plane>
|
||||||
|
</geometry>
|
||||||
|
</collision>
|
||||||
|
<visual name="visual">
|
||||||
|
<geometry>
|
||||||
|
<plane>
|
||||||
|
<normal>0 0 1</normal>
|
||||||
|
<size>100 100</size>
|
||||||
|
</plane>
|
||||||
|
</geometry>
|
||||||
|
<material>
|
||||||
|
<ambient>0.8 0.8 0.8 1</ambient>
|
||||||
|
<diffuse>0.8 0.8 0.8 1</diffuse>
|
||||||
|
<specular>0.8 0.8 0.8 1</specular>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
</link>
|
||||||
|
</model>
|
||||||
|
|
||||||
</world>
|
</world>
|
||||||
</sdf>
|
</sdf>
|
||||||
Reference in New Issue
Block a user