-
Notifications
You must be signed in to change notification settings - Fork 263
Adding Gazebo for rrbot #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
2a7dfc9
67be5c5
da5f235
b18c780
e6497f1
e230567
5e726d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| controller_manager: | ||
| ros__parameters: | ||
| update_rate: 100 # Hz | ||
|
|
||
| joint_trajectory_controller: | ||
| type: joint_trajectory_controller/JointTrajectoryController | ||
|
|
||
| joint_state_controller: | ||
| type: joint_state_controller/JointStateController | ||
|
|
||
| joint_trajectory_controller: | ||
| ros__parameters: | ||
| joints: | ||
| - joint1 | ||
| - joint2 | ||
| interface_name: position | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,24 @@ | ||
| <?xml version="1.0"?> | ||
| <robot xmlns:xacro="http://www.ros.org/wiki/xacro"> | ||
|
|
||
| <xacro:macro name="rrbot_system_position_only" params="name prefix"> | ||
| <xacro:macro name="rrbot_system_position_only" params="name prefix simu:='false' "> | ||
|
|
||
| <ros2_control name="${name}" type="system"> | ||
| <hardware> | ||
| <plugin>ros2_control_demo_hardware/RRBotSystemPositionOnlyHardware</plugin> | ||
| <param name="example_param_hw_start_duration_sec">2.0</param> | ||
| <param name="example_param_hw_stop_duration_sec">3.0</param> | ||
| <param name="example_param_hw_slowdown">2.0</param> | ||
| </hardware> | ||
|
|
||
| <xacro:if value="$(arg simu)"> | ||
| <hardware> | ||
| <plugin>gazebo_ros2_control/GazeboSystem</plugin> | ||
| </hardware> | ||
| </xacro:if> | ||
| <xacro:unless value="$(arg simu)"> | ||
| <hardware> | ||
| <plugin>ros2_control_demo_hardware/RRBotSystemPositionOnlyHardware</plugin> | ||
| <param name="example_param_hw_start_duration_sec">2.0</param> | ||
| <param name="example_param_hw_stop_duration_sec">3.0</param> | ||
| <param name="example_param_hw_slowdown">2.0</param> | ||
|
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not parsed in the plugin
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I misunderstood your comment, but this part is not included in the file generated by xacro because it is in the |
||
| </hardware> | ||
| </xacro:unless> | ||
|
|
||
| <joint name="joint1"> | ||
| <command_interface name="position"> | ||
| <param name="min">-1</param> | ||
|
|
@@ -29,4 +38,3 @@ | |
| </xacro:macro> | ||
|
|
||
| </robot> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ Copied and modified from ROS1 example: | |
| https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro | ||
| --> | ||
| <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="2dof_robot"> | ||
|
|
||
| <xacro:arg name="simu" default="false" /> | ||
|
||
|
|
||
| <!-- Import RRBot macro --> | ||
| <xacro:include filename="rrbot/rrbot.urdf.xacro" /> | ||
| <!-- <xacro:include filename="$(find ros2_control_demo_robot)/description/rrbot/rrbot.urdf.xacro" /> --> | ||
|
|
@@ -34,6 +35,6 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc | |
|
|
||
| <xacro:rrbot_gazebo prefix="" /> | ||
|
|
||
| <xacro:rrbot_system_position_only name="RRBotSystemPositionOnly" prefix="" /> | ||
| <xacro:rrbot_system_position_only name="RRBotSystemPositionOnly" prefix="" simu="$(arg simu)" /> | ||
|
|
||
| </robot> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Copyright 2021 Open Source Robotics Foundation, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import os | ||
|
|
||
| from ament_index_python.packages import get_package_share_directory | ||
|
|
||
|
|
||
| from launch import LaunchDescription | ||
| from launch.actions import IncludeLaunchDescription | ||
| from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
|
|
||
| from launch_ros.actions import Node | ||
|
|
||
| import xacro | ||
|
|
||
|
|
||
| def generate_launch_description(): | ||
| gazebo = IncludeLaunchDescription( | ||
| PythonLaunchDescriptionSource([os.path.join( | ||
| get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), | ||
| ) | ||
|
|
||
| robot_description_path = os.path.join( | ||
| get_package_share_directory('ros2_control_demo_robot'), | ||
| 'description', | ||
| 'rrbot_system_position_only.urdf.xacro') | ||
| robot_description_config = xacro.process_file( | ||
| robot_description_path, | ||
| mappings={'simu': 'true'}) | ||
| robot_description = {'robot_description': robot_description_config.toxml()} | ||
|
|
||
| node_robot_state_publisher = Node( | ||
| package='robot_state_publisher', | ||
| executable='robot_state_publisher', | ||
| output='screen', | ||
| parameters=[robot_description] | ||
| ) | ||
|
|
||
| spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', | ||
| arguments=['-topic', 'robot_description', | ||
| '-entity', 'cartpole'], | ||
|
||
| output='screen') | ||
|
|
||
| return LaunchDescription([ | ||
| gazebo, | ||
| node_robot_state_publisher, | ||
| spawn_entity, | ||
| ]) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| <depend>hardware_interface</depend> | ||
| <depend>pluginlib</depend> | ||
| <depend>rclcpp</depend> | ||
| <depend>gazebo_ros2_control</depend> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're missing an
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Fixed in e6497f1 |
||
|
|
||
| <depend>ros2_control_demo_hardware</depend> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@destogl can you explain what that interface name does here? I'd assume that the joints are sufficiently described in the ros2_control tag with their control and state interfaces names.
What if I use
positionhere and declare the joints aseffort?