-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎈 perf: Add launch param
use_robot_state_pub
- Loading branch information
1 parent
2fbf1d7
commit 1d80aae
Showing
4 changed files
with
154 additions
and
33 deletions.
There are no files selected for viewing
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
123 changes: 123 additions & 0 deletions
123
pb2025_nav_bringup/launch/rm_sentry_state_publisher_launch.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# NOTE: This startup file is only used when the navigation module is standalone | ||
# It is used to launch the robot state publisher and joint state publisher. | ||
# But in a complete robot system, this part should be completed by an independent robot startup module | ||
|
||
import os | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, GroupAction | ||
from launch.conditions import IfCondition | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import Node, PushRosNamespace | ||
from sdformat_tools.urdf_generator import UrdfGenerator | ||
from xmacro.xmacro4sdf import XMLMacro4sdf | ||
|
||
|
||
def generate_launch_description(): | ||
# Get the launch directory | ||
pkg_pb2025_robot_description_dir = get_package_share_directory( | ||
"pb2025_robot_description" | ||
) | ||
|
||
namespace = LaunchConfiguration("namespace") | ||
use_namespace = LaunchConfiguration("use_namespace") | ||
use_sim_time = LaunchConfiguration("use_sim_time") | ||
# xmacro_description = LaunchConfiguration("xmacro_description") | ||
xmacro_description = os.path.join( | ||
pkg_pb2025_robot_description_dir, | ||
"resource", | ||
"xmacro", | ||
"pb2025_sentry_robot.sdf.xmacro", | ||
) | ||
|
||
# Map fully qualified names to relative ones so the node's namespace can be prepended. | ||
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative | ||
# https://github.com/ros/geometry2/issues/32 | ||
# https://github.com/ros/robot_state_publisher/pull/30 | ||
# TODO(orduno) Substitute with `PushNodeRemapping` | ||
# https://github.com/ros2/launch_ros/issues/56 | ||
remappings = [("/tf", "tf"), ("/tf_static", "tf_static")] | ||
|
||
# Declare the launch arguments | ||
declare_namespace_cmd = DeclareLaunchArgument( | ||
"namespace", | ||
default_value="", | ||
description="Top-level namespace", | ||
) | ||
|
||
declare_use_namespace_cmd = DeclareLaunchArgument( | ||
"use_namespace", | ||
default_value="false", | ||
description="Whether to apply a namespace to the navigation stack", | ||
) | ||
|
||
declare_use_sim_time_cmd = DeclareLaunchArgument( | ||
"use_sim_time", | ||
default_value="false", | ||
description="Use simulation (Gazebo) clock if true", | ||
) | ||
|
||
# declare_xmacro_description_cmd = DeclareLaunchArgument( | ||
# "xmacro_description", | ||
# default_value=os.path.join( | ||
# pkg_pb2025_robot_description_dir, | ||
# "resource", | ||
# "xmacro", | ||
# "rmul24_sentry_robot.sdf.xmacro", | ||
# ), | ||
# description="Robot description in xmacro format", | ||
# ) | ||
|
||
xmacro = XMLMacro4sdf() | ||
xmacro.set_xml_file(xmacro_description) | ||
|
||
# Generate SDF from xmacro | ||
xmacro.generate() | ||
robot_xml = xmacro.to_string() | ||
|
||
# Generate URDF from SDF | ||
urdf_generator = UrdfGenerator() | ||
urdf_generator.parse_from_sdf_string(robot_xml) | ||
robot_urdf_xml = urdf_generator.to_string() | ||
|
||
bringup_cmd_group = GroupAction( | ||
[ | ||
PushRosNamespace(condition=IfCondition(use_namespace), namespace=namespace), | ||
Node( | ||
package="joint_state_publisher", | ||
executable="joint_state_publisher", | ||
name="joint_state_publisher", | ||
output="screen", | ||
# TODO: Using serial_driver to publish `gimbal_yaw` and `gimbal_pitch` joint. | ||
# parameters=[{"source_list": [""]}], | ||
remappings=remappings, | ||
), | ||
Node( | ||
package="robot_state_publisher", | ||
executable="robot_state_publisher", | ||
name="robot_state_publisher", | ||
remappings=remappings, | ||
parameters=[ | ||
{ | ||
"use_sim_time": use_sim_time, | ||
"robot_description": robot_urdf_xml, | ||
} | ||
], | ||
), | ||
] | ||
) | ||
|
||
# Create the launch description and populate | ||
ld = LaunchDescription() | ||
|
||
# Declare the launch options | ||
ld.add_action(declare_namespace_cmd) | ||
ld.add_action(declare_use_namespace_cmd) | ||
ld.add_action(declare_use_sim_time_cmd) | ||
# ld.add_action(declare_xmacro_description_cmd) | ||
|
||
# Add the actions to launch all nodes | ||
ld.add_action(bringup_cmd_group) | ||
|
||
return ld |
Submodule small_gicp_relocalization
updated
3 files
+4 −1 | include/small_gicp_relocalization/small_gicp_relocalization.hpp | |
+1 −0 | package.xml | |
+24 −1 | src/small_gicp_relocalization.cpp |