Add support to Ignition Gazebo.
authorWalter Fetter Lages <w.fetter@ieee.org>
Thu, 15 Sep 2022 05:53:18 +0000 (02:53 -0300)
committerWalter Fetter Lages <w.fetter@ieee.org>
Thu, 15 Sep 2022 05:53:18 +0000 (02:53 -0300)
q2d_bringup/launch/ignition.launch.xml [new file with mode: 0644]
q2d_description/CMakeLists.txt
q2d_description/env-hooks/q2d_description.dsv.in [new file with mode: 0644]
q2d_description/launch/display.launch.py
q2d_description/launch/display.launch.xml
q2d_description/launch/gazebo.launch.xml
q2d_description/launch/ignition.launch.xml [new file with mode: 0644]
q2d_description/launch/q2d.launch.xml
q2d_description/urdf/q2d.urdf

diff --git a/q2d_bringup/launch/ignition.launch.xml b/q2d_bringup/launch/ignition.launch.xml
new file mode 100644 (file)
index 0000000..d2305bd
--- /dev/null
@@ -0,0 +1,40 @@
+<!--******************************************************************************
+                          Quanser 2DSFJE Bringup
+                        Ignition Gazebo Launch File
+          Copyright (C) 2018, 2022 Walter Fetter Lages <w.fetter@ieee.org>
+
+        This program is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, either version 3 of the License, or
+        (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful, but
+        WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+        Geneal Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see
+        <http://www.gnu.org/licenses/>.
+        
+*******************************************************************************-->
+
+<launch>
+       <arg name="pause" default="true"/>
+       <arg name="gui" default="true"/>
+       <arg name="use_sim_time" default="true"/>
+
+       <arg name="controller" default="pid"/>
+       <arg name="config" default="$(find-pkg-share q2d_bringup)/config/$(var controller).yaml"/>
+
+       <include file="$(find-pkg-share q2d_description)/launch/ignition.launch.xml" >
+               <arg name="pause" value="$(var pause)"/>
+               <arg name="gui" value="$(var gui)"/>
+               <arg name="use_sim_time" value="$(var use_sim_time)"/>
+       </include>
+
+       <include file="$(find-pkg-share q2d_bringup)/launch/$(var controller).launch.xml" >
+               <arg name="config" value="$(var config)"/>
+               <arg name="use_sim_time" value="$(var use_sim_time)"/>
+       </include>
+</launch>
index cd6ed07..8bc8c3c 100644 (file)
@@ -26,4 +26,6 @@ if(BUILD_TESTING)
   ament_lint_auto_find_test_dependencies()
 endif()
 
+ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.dsv.in")
+
 ament_package()
diff --git a/q2d_description/env-hooks/q2d_description.dsv.in b/q2d_description/env-hooks/q2d_description.dsv.in
new file mode 100644 (file)
index 0000000..30a6001
--- /dev/null
@@ -0,0 +1,3 @@
+prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share
+
+set-if-unset;MESA_GL_VERSION_OVERRIDE;3.3
index 645a58a..d3745f6 100644 (file)
@@ -1,3 +1,24 @@
+#******************************************************************************
+#                         Quanser 2DSFJE Description
+#                           RViz Launch File
+#          Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+#
+#        This program is free software: you can redistribute it and/or modify
+#        it under the terms of the GNU General Public License as published by
+#        the Free Software Foundation, either version 3 of the License, or
+#        (at your option) any later version.
+#
+#        This program is distributed in the hope that it will be useful, but
+#        WITHOUT ANY WARRANTY; without even the implied warranty of
+#        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#        Geneal Public License for more details.
+#
+#        You should have received a copy of the GNU General Public License
+#        along with this program.  If not, see
+#        <http://www.gnu.org/licenses/>.
+#
+#*******************************************************************************
+
 import os
 from ament_index_python.packages import get_package_share_directory
 from launch import LaunchDescription
@@ -8,7 +29,7 @@ from launch_ros.actions import Node
 
 def generate_launch_description():
 
-        use_gui=LaunchConfiguration('use_gui',default='false')
+        gui=LaunchConfiguration('gui',default='false')
 
         urdf_file_name = 'urdf/q2d.urdf'
         urdf_path=os.path.join(get_package_share_directory('q2d_description'),urdf_file_name)
@@ -20,19 +41,19 @@ def generate_launch_description():
 
         return LaunchDescription([
                 DeclareLaunchArgument(
-                        'use_gui',
+                        'gui',
                         default_value='false',
                         description='Use graphical user interface to publish jointstates if true'),
                 Node(
                         package='tf2_ros',
                         executable='static_transform_publisher',
                         name='q2d_origin_publisher',
-                        arguments=["0","0","0","0","0","0","1","map","origin_link"]),
+                        arguments=["--frame-id", "map","--child-frame-id","origin_link"]),
                 Node(
                         package='joint_state_publisher_gui',
                         executable='joint_state_publisher_gui',
                         name='joint_state_publisher',
-                        condition=IfCondition(LaunchConfiguration("use_gui"))),
+                        condition=IfCondition(LaunchConfiguration("gui"))),
                 Node(
                         package='robot_state_publisher',
                         executable='robot_state_publisher',
index d91bd82..807304d 100644 (file)
@@ -1,7 +1,28 @@
+<!--******************************************************************************
+                          Quanser 2DSFJE Description
+                            RViz Launch File
+          Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+
+        This program is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, either version 3 of the License, or
+        (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful, but
+        WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+        Geneal Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see
+        <http://www.gnu.org/licenses/>.
+
+*******************************************************************************-->
+
 <launch>
-       <arg name="use_gui" default="false"/>
-       <node pkg="tf2_ros" exec="static_transform_publisher" name="q2d_origin_publisher" args="0 0 0 0 0 0 1 map origin_link" />
-       <node if="$(var use_gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" exec="joint_state_publisher_gui" />
+       <arg name="gui" default="false"/>
+       <node pkg="tf2_ros" exec="static_transform_publisher" name="q2d_origin_publisher" args="--frame-id map --child-frame-id origin_link"/>
+       <node if="$(var gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" exec="joint_state_publisher_gui"/>
        <include file="$(find-pkg-share q2d_description)/launch/q2d.launch.xml"/>
-       <node name="rviz" pkg="rviz2" exec="rviz2" args="-d $(find-pkg-share q2d_description)/config/display.rviz" />
+       <node name="rviz" pkg="rviz2" exec="rviz2" args="-d $(find-pkg-share q2d_description)/config/display.rviz"/>
 </launch>
index e01e744..60fd755 100644 (file)
@@ -16,7 +16,7 @@
         You should have received a copy of the GNU General Public License
         along with this program.  If not, see
         <http://www.gnu.org/licenses/>.
-        
+
 *******************************************************************************-->
 
 <launch>
diff --git a/q2d_description/launch/ignition.launch.xml b/q2d_description/launch/ignition.launch.xml
new file mode 100644 (file)
index 0000000..4e39ec5
--- /dev/null
@@ -0,0 +1,46 @@
+<!--******************************************************************************
+                          Quanser 2DSFJE Description
+                          Ignition Gazebo Launch File
+          Copyright (C) 2018..2022 Walter Fetter Lages <w.fetter@ieee.org>
+
+        This program is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, either version 3 of the License, or
+        (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful, but
+        WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+        Geneal Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see
+        <http://www.gnu.org/licenses/>.
+        
+*******************************************************************************-->
+
+<launch>
+       <arg name="pause" default="true"/>
+       <arg name="gui" default="true"/>
+       <arg name="use_sim_time" default="true"/>
+
+       <arg unless="$(var pause)" name="ign_pause" default="-r"/>
+       <arg if="$(var pause)" name="ign_pause" default=""/>
+               
+       <arg unless="$(var gui)" name="ign_gui" default="-s"/>
+       <arg if="$(var gui)" name="ign_gui" default=""/>
+
+       <include file="$(find-pkg-share ros_ign_gazebo)/launch/ign_gazebo.launch.py">
+               <arg name="ign_args" value="$(var ign_pause) $(var ign_gui) -v 4 empty.sdf"/>
+       </include>
+
+       <include file="$(find-pkg-share q2d_description)/launch/q2d.launch.xml">
+               <arg name="use_sim_time" value="$(var use_sim_time)"/>
+       </include>
+
+       <node name="q2d_spawner" pkg="ros_ign_gazebo" exec="create" args="-topic robot_description -name q2d"/>
+
+       <node name="clock_bridge" pkg="ros_ign_bridge" exec="parameter_bridge" args="/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock">
+               <param name="use_sim_time" value="$(var use_sim_time)"/>
+       </node>
+ </launch>
index 1972173..7237d75 100644 (file)
@@ -1,3 +1,24 @@
+<!--******************************************************************************
+                          Quanser 2DSFJE Description
+                          Quanser 2DSFJE Launch File
+          Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+
+        This program is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, either version 3 of the License, or
+        (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful, but
+        WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+        Geneal Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see
+        <http://www.gnu.org/licenses/>.
+
+*******************************************************************************-->
+
 <launch>
        <arg name="use_sim_time" default="false"/>
 
index 0c9c464..11f63e0 100644 (file)
                        <parameters>$(find q2d_description)/config/controller_manager.yaml</parameters>\r
                </plugin>\r
        </gazebo>\r
+<!--
+       <ros2_control name="IgnitionSystem" type="system">
+               <hardware>
+                       <plugin>ign_ros2_control/IgnitionSystem</plugin>
+               </hardware>
+
+               <joint name="shoulder_active_joint">
+                       <command_interface name="effort">
+                               <param name="min">-27.94</param>
+                               <param name="max">27.94</param>
+                       </command_interface>
+                       <state_interface name="position"/>
+                       <state_interface name="velocity"/>
+                       <state_interface name="effort"/>
+               </joint>
+
+               <joint name="elbow_active_joint">
+                       <command_interface name="effort">
+                               <param name="min">-13.62</param>
+                               <param name="max">13.62</param>
+                       </command_interface>
+                       <state_interface name="position"/>
+                       <state_interface name="velocity"/>
+                       <state_interface name="effort"/>
+               </joint>
+       </ros2_control>
+
+       <gazebo>
+               <plugin filename="libign_ros2_control-system.so" name="ign_ros2_control::IgnitionROS2ControlPlugin">
+                       <robot_param>robot_description</robot_param>
+                       <robot_param_node>robot_state_publisher</robot_param_node>
+                       <parameters>$(find q2d_description)/config/controller_manager.yaml</parameters>
+               </plugin>
+       </gazebo>
+-->
 </robot>\r