fix: preserve FRI settings and update CLI safely

This commit is contained in:
Даниил Грабарь
2026-09-16 14:25:49 +10:00
parent 36d620317a
commit 7f9b120fe8
4 changed files with 44 additions and 22 deletions
+9 -1
View File
@@ -4,7 +4,7 @@ import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, LogInfo, OpaqueFunction
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
@@ -50,6 +50,7 @@ def _runtime_setup(context, *args, **kwargs):
"initial_positions_file": settings.controller.moveit.initial_positions,
"robot_ip": settings.robot.ip,
"fri_port": str(settings.robot.port),
"fri_cycle_ms": str(settings.robot.fri_cycle_ms),
"simulate": "false",
}
@@ -120,6 +121,13 @@ def _runtime_setup(context, *args, **kwargs):
"fri_port": str(settings.robot.port),
}
if not simulate:
setup.append(LogInfo(msg=(
"FRI configured from cobot-setting.yaml: "
f"period={settings.robot.fri_cycle_ms} ms, "
f"endpoint={settings.robot.ip}:{settings.robot.port}"
)))
setup.append(IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution([
@@ -1,5 +1,5 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.actions import DeclareLaunchArgument, LogInfo, OpaqueFunction
from launch.substitutions import LaunchConfiguration
from launch.event_handlers import OnProcessExit
from launch.actions import RegisterEventHandler
@@ -126,6 +126,7 @@ def _setup_controllers(context, *args, **kwargs):
)
return [
LogInfo(msg=f"FRI controller period={fri_cycle_ms} ms; Controller Manager rate={update_rate} Hz"),
ros2_control_node,
jsb,
jtc_after_jsb,