Skip to content

Commit

Permalink
Restore base version of canopen_system example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerry Salinas committed Mar 19, 2024
1 parent d40d495 commit 73d7135
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
4 changes: 2 additions & 2 deletions canopen_tests/config/canopen_system/ros2_controllers.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__namespace__/controller_manager:
controller_manager:
ros__parameters:
update_rate: 10 # Hz

Expand All @@ -8,6 +8,6 @@ __namespace__/controller_manager:
node_1_controller:
type: canopen_ros2_controllers/CanopenProxyController

__namespace__/node_1_controller:
node_1_controller:
ros__parameters:
joint: node_1
23 changes: 3 additions & 20 deletions canopen_tests/launch/canopen_system.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@

from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.actions import GroupAction
from launch_ros.actions import PushROSNamespace
from nav2_common.launch import ReplaceString


def launch_setup(context, *args, **kwargs):
can_ns = LaunchConfiguration("can_ns")

name = LaunchConfiguration("name")
prefix = LaunchConfiguration("prefix")

Expand Down Expand Up @@ -114,11 +111,6 @@ def launch_setup(context, *args, **kwargs):
]
)

ros2_control_config = ReplaceString(
source_file=ros2_control_config,
replacements={"__namespace__/":(can_ns, "/")}
)

# nodes to start are listed below
control_node = Node(
package="controller_manager",
Expand All @@ -131,13 +123,13 @@ def launch_setup(context, *args, **kwargs):
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster"]
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
)

canopen_proxy_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["node_1_controller"]
arguments=["node_1_controller", "--controller-manager", "/controller_manager"],
)

robot_state_publisher_node = Node(
Expand Down Expand Up @@ -182,21 +174,12 @@ def launch_setup(context, *args, **kwargs):
canopen_proxy_controller_spawner,
]

actions = [PushROSNamespace(can_ns)]
actions.extend(nodes_to_start)
return [GroupAction(actions=actions)]

return nodes_to_start


def generate_launch_description():

declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"can_ns", description="namespace", default_value="",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"name", description="robot name", default_value="canopen_test_system"
Expand Down

0 comments on commit 73d7135

Please sign in to comment.