Skip to content

Commit

Permalink
Mock components対応 (#16)
Browse files Browse the repository at this point in the history
* add dependency for jazzy

* display.launchの動作確認とCIが通るようにフォーマット修正

* gz-sim対応

* プランニングできるように可動範囲を微調整

* センサ周りのgz移行もれ

* doc, ciをJazzy対応

* bug fix

* 手首の可動範囲を広げる

* add mock components support

* Update test/test_robot_description_loader.py

Co-authored-by: Kuwamai <[email protected]>

---------

Co-authored-by: Kuwamai <[email protected]>
  • Loading branch information
chama1176 and Kuwamai authored Nov 25, 2024
1 parent 2d37b80 commit 9ce1257
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 2 additions & 0 deletions sciurus17_description/robot_description_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
self.use_gazebo = 'false'
self.use_gazebo_head_camera = 'false'
self.use_gazebo_chest_camera = 'false'
self.use_mock_components = 'false'
self.gz_control_config_package = ''
self.gz_control_config_file_path = ''

Expand All @@ -34,6 +35,7 @@ def load(self):
' use_gazebo:=', self.use_gazebo,
' use_gazebo_head_camera:=', self.use_gazebo_head_camera,
' use_gazebo_chest_camera:=', self.use_gazebo_chest_camera,
' use_mock_components:=', self.use_mock_components,
' gz_control_config_package:=', self.gz_control_config_package,
' gz_control_config_file_path:=', self.gz_control_config_file_path
])
9 changes: 9 additions & 0 deletions test/test_robot_description_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,12 @@ def test_use_gazebo_chest_camera():
rdl.gz_control_config_package = 'sciurus17_description'
rdl.gz_control_config_file_path = 'config/dummy_controllers.yaml'
assert 'reference="chest_camera_link"' in exec_load(rdl)


def test_use_mock_components():
# use_mock_componentsが変更され、xacroにmock_componentsがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.use_mock_components = 'true'
rdl.gz_control_config_package = 'sciurus17_description'
rdl.gz_control_config_file_path = 'config/dummy_controllers.yaml'
assert 'mock_components/GenericSystem' in exec_load(rdl)
15 changes: 10 additions & 5 deletions urdf/sciurus17.ros2_control.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

<ros2_control name="sciurus17" type="system">
<hardware>
<plugin>sciurus17_hardware/Sciurus17Hardware</plugin>
<param name="port_name">${PORT_NAME}</param>
<param name="baudrate">${BAUDRATE}</param>
<param name="timeout_seconds">${TIMEOUT_SECONDS}</param>
<param name="manipulator_config_file_path">${MANIPULATOR_CONFIG_FILE_PATH}</param>
<xacro:if value="${USE_MOCK_COMPONENTS}">
<plugin>mock_components/GenericSystem</plugin>
</xacro:if>
<xacro:unless value="${USE_MOCK_COMPONENTS}">
<plugin>sciurus17_hardware/Sciurus17Hardware</plugin>
<param name="port_name">${PORT_NAME}</param>
<param name="baudrate">${BAUDRATE}</param>
<param name="timeout_seconds">${TIMEOUT_SECONDS}</param>
<param name="manipulator_config_file_path">${MANIPULATOR_CONFIG_FILE_PATH}</param>
</xacro:unless>
</hardware>

<joint name="${NAME_JOINT_BODY}">
Expand Down
2 changes: 2 additions & 0 deletions urdf/sciurus17.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<xacro:arg name="use_gazebo" default="false" />
<xacro:arg name="use_gazebo_head_camera" default="false" />
<xacro:arg name="use_gazebo_chest_camera" default="false" />
<xacro:arg name="use_mock_components" default="false" />
<xacro:arg name="port_name" default="/dev/sciurus17spine" />
<xacro:arg name="baudrate" default="3000000" />
<xacro:arg name="timeout_seconds" default="1.0" />
Expand All @@ -28,6 +29,7 @@
<xacro:arg name="gz_control_config_file_path" default="" />
<xacro:property name="USE_GAZEBO_HEAD_CAMERA" value="$(arg use_gazebo_head_camera)"/>
<xacro:property name="USE_GAZEBO_CHEST_CAMERA" value="$(arg use_gazebo_chest_camera)"/>
<xacro:property name="USE_MOCK_COMPONENTS" value="$(arg use_mock_components)"/>
<xacro:property name="PORT_NAME" value="$(arg port_name)"/>
<xacro:property name="BAUDRATE" value="$(arg baudrate)"/>
<xacro:property name="TIMEOUT_SECONDS" value="$(arg timeout_seconds)"/>
Expand Down

0 comments on commit 9ce1257

Please sign in to comment.