Add robot definition URDF
This enables rviz2 to know where sensors etc are. None of the data is correct for the raspbot-v2 yet.
This commit is contained in:
@@ -1,10 +1,22 @@
|
||||
import os
|
||||
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch.substitutions import LaunchConfiguration, Command
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.parameter_descriptions import ParameterValue
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
urdf_file = os.path.join(
|
||||
get_package_share_directory('raspbot_v2'), 'urdf', 'raspbot_v2.urdf.xacro'
|
||||
)
|
||||
robot_description = ParameterValue(
|
||||
Command(['xacro ', urdf_file]),
|
||||
value_type=str,
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
|
||||
# ── Motor controller arguments ────────────────────────────────────
|
||||
@@ -23,6 +35,33 @@ def generate_launch_description():
|
||||
DeclareLaunchArgument('tilt_center_deg', default_value='60.0',
|
||||
description='Tilt angle at startup and shutdown (degrees)'),
|
||||
|
||||
# ── TF / robot description ────────────────────────────────────────
|
||||
Node(
|
||||
package='robot_state_publisher',
|
||||
executable='robot_state_publisher',
|
||||
name='robot_state_publisher',
|
||||
parameters=[{'robot_description': robot_description}],
|
||||
output='screen',
|
||||
),
|
||||
|
||||
# Static: map → odom (identity — replace with SLAM/AMCL when ready)
|
||||
Node(
|
||||
package='tf2_ros',
|
||||
executable='static_transform_publisher',
|
||||
name='map_to_odom',
|
||||
arguments=['0', '0', '0', '0', '0', '0', 'map', 'odom'],
|
||||
output='screen',
|
||||
),
|
||||
|
||||
# Static: odom → base_footprint (placeholder until odometry is added)
|
||||
Node(
|
||||
package='tf2_ros',
|
||||
executable='static_transform_publisher',
|
||||
name='odom_to_base',
|
||||
arguments=['0', '0', '0', '0', '0', '0', 'odom', 'base_footprint'],
|
||||
output='screen',
|
||||
),
|
||||
|
||||
# ── Nodes ─────────────────────────────────────────────────────────
|
||||
Node(
|
||||
package='raspbot_v2',
|
||||
|
||||
Reference in New Issue
Block a user