Skip to content

Commit

Permalink
Merge pull request #5 from helix-robotics-ag/seb/add_current_control
Browse files Browse the repository at this point in the history
Seb/add current control
  • Loading branch information
sebtiburzio authored Feb 15, 2024
2 parents 1b0a895 + c9d13f0 commit 0016f80
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 38 deletions.
38 changes: 24 additions & 14 deletions helix_bringup/launch/helix_bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from launch import LaunchDescription
from launch_ros.actions import Node
# from launch.actions import RegisterEventHandler
# from launch.event_handlers import OnProcessExit

def generate_launch_description():

Expand Down Expand Up @@ -53,6 +55,14 @@ def generate_launch_description():
output="screen",
)

# ros2_control 'controller' (broadcaster) for motor joint states
motor_head_joint_state_broadcaster_node = Node(
package="controller_manager",
executable="spawner",
arguments=["motor_head_joint_state_broadcaster", "--controller-manager", "/controller_manager"],
output="screen",
)

# ros2_control controller for motor joint positions
motor_head_joint_position_controller_node = Node(
package="controller_manager",
Expand All @@ -62,27 +72,27 @@ def generate_launch_description():
)

# ros2_control controller for motor joint efforts
# motor_head_helix_joint_effort_controller_node = Node(
# package="controller_manager",
# executable="spawner",
# arguments=["motor_head_joint_effort_controller", "--inactive", "-c", "/controller_manager"],
# output="screen",
# )

# ros2_control 'controller' (broadcaster) for motor joint states
motor_head_joint_state_broadcaster_node = Node(
package="controller_manager",
executable="spawner",
arguments=["motor_head_joint_state_broadcaster", "--controller-manager", "/controller_manager"],
output="screen",
motor_head_helix_joint_effort_controller_node = Node(
package="controller_manager",
executable="spawner",
arguments=["motor_head_joint_effort_controller", "--inactive", "-c", "/controller_manager"],
output="screen",
)

# # Delay start of motor_head_joint_position_controller_node after `motor_head_joint_state_broadcaster_node`
# delay_joint_controller_after_broadcaster = RegisterEventHandler(
# event_handler=OnProcessExit(
# target_action=motor_head_joint_state_broadcaster_node,
# on_exit=[motor_head_joint_position_controller_node],
# )
# )

ld.add_action(robot_state_publisher)
ld.add_action(joint_state_publisher_node)
ld.add_action(helix_ros2_control_node)
ld.add_action(motor_head_joint_position_controller_node)
# ld.add_action(motor_head_helix_joint_effort_controller_node)
ld.add_action(motor_head_helix_joint_effort_controller_node)
ld.add_action(motor_head_joint_state_broadcaster_node)
# ld.add_action(delay_joint_controller_after_broadcaster)

return ld
28 changes: 14 additions & 14 deletions helix_description/config/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ controller_manager:
motor_head_joint_position_controller:
type: position_controllers/JointGroupPositionController

# motor_head_joint_effort_controller:
# type: effort_controllers/JointGroupEffortController
motor_head_joint_effort_controller:
type: effort_controllers/JointGroupEffortController

motor_head_joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
Expand All @@ -24,18 +24,18 @@ motor_head_joint_position_controller:
- joint7
- joint8

# motor_head_joint_effort_controller:
# ros__parameters:
# joints:
# - joint0
# - joint1
# - joint2
# - joint3
# - joint4
# - joint5
# - joint6
# - joint7
# - joint8
motor_head_joint_effort_controller:
ros__parameters:
joints:
- joint0
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6
- joint7
- joint8

motor_head_joint_state_broadcaster:
ros__parameters:
Expand Down
18 changes: 9 additions & 9 deletions helix_description/urdf/helix.ros2_control.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,71 @@
<param name="id">0</param>
<command_interface name="position"/>
<!-- effort interface for current control -->
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint1">
<param name="id">1</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint2">
<param name="id">2</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint3">
<param name="id">3</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint4">
<param name="id">4</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint5">
<param name="id">5</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint6">
<param name="id">6</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint7">
<param name="id">7</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
</joint>
<joint name="joint8">
<param name="id">8</param>
<command_interface name="position"/>
<!-- <command_interface name="effort"/> -->
<command_interface name="effort"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
<state_interface name="effort"/>
Expand Down

0 comments on commit 0016f80

Please sign in to comment.