install(PROGRAMS
scripts/ijc_step.sh
scripts/ijc_square.py
- scripts/group_torque_step.sh
+ scripts/torque_step.sh
scripts/joint_trajectory_step.sh
DESTINATION lib/${PROJECT_NAME}
)
-shoulder_controller:
+bypass_controller:
ros__parameters:
- joints:
+ type: effort_controllers/JointGroupEffortController
+ joints:
- shoulder_active_joint
- interface_name: effort
-
-elbow_controller:
- ros__parameters:
- joints:
- elbow_active_joint
- interface_name: effort
computed_torque_controller:
ros__parameters:
+ type: computed_torque_controller/ComputedTorqueController
joints:
- shoulder_active_joint
- elbow_active_joint
+++ /dev/null
-group_bypass:
- ros__parameters:
- joints:
- - shoulder_active_joint
- - elbow_active_joint
+++ /dev/null
-group_controller:
- ros__parameters:
- joints:
- - shoulder_active_joint
- - elbow_active_joint
- shoulder_active_joint/pid: {p: 2310, i: 4640, d: 0.299}
- elbow_active_joint/pid: {p: 339, i: 851, d: 0.351}
--- /dev/null
+joint_state_broadcaster:
+ ros__parameters:
+ type: joint_state_broadcaster/JointStateBroadcaster
-shoulder_controller:
+pid_controller:
ros__parameters:
- joint: shoulder_active_joint
- pid: {p: 2310, i: 4640, d: 0.299}
-
-elbow_controller:
- ros__parameters:
- joint: elbow_active_joint
- pid: {p: 339, i: 851, d: 0.351}
+ type: pid_controller/PidController
+ dof_names:
+ - shoulder_active_joint
+ - elbow_active_joint
+ command_interface: effort
+ reference_and_state_interfaces: ["position"]
+ gains:
+ shoulder_active_joint: {p: 2310.0, i: 4640.0, d: 0.299, i_clamp_max: 100.0, i_clamp_min: -100.0, antiwindup: false}
+ elbow_active_joint: {p: 339.0, i: 841.0, d: 0.351, i_clamp_max: 100.0, i_clamp_min: -100.0, antiwindup: false}
+++ /dev/null
-pid_plus_gravity_controller:
- ros__parameters:
- joints:
- - shoulder_active_joint
- - elbow_active_joint
- shoulder_active_joint: {p: 2310.0, i: 4640.0, d: 0.299, i_clamp_max: 27.94, i_clamp_min: -27.94}
- elbow_active_joint: {p: 339.0, i: 851.0, d: 0.351, i_clamp_max: 13.62, i_clamp_min: -13.62}
- gravity: {x: 0.0, y: 0.0, z: -9.8}
- chain: {root: "origin_link", tip: "tool_link"}
- priority: 99
<!--******************************************************************************
Quanser 2DSFJE Bringup
- Bypass controller Launch File
- Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+ Bypass Controller Launch File
+ Copyright (C) 2018..2024 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
<launch>
<arg name="config" default="$(find-pkg-share q2d_bringup)/config/bypass.yaml"/>
-
- <node name="shoulder_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t forward_command_controller/ForwardCommandController -p $(var config) shoulder_controller"/>
- <node name="elbow_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t forward_command_controller/ForwardCommandController -p $(var config) elbow_controller"/>
-
+ <node name="bypass_controller_spawner" pkg="controller_manager" exec="spawner"
+ args="-p $(var config) bypass_controller"/>
+
<node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
+ args="-p $(find-pkg-share q2d_bringup)/config/joint_state_broadcaster.yaml joint_state_broadcaster"/>
</launch>
<!--******************************************************************************
Quanser 2DSFJE Bringup
Computed Torque Controller Launch File
- Copyright (C) 2021 Walter Fetter Lages <w.fetter@ieee.org>
+ Copyright (C) 2021..2024 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
<arg name="config" default="$(find-pkg-share q2d_bringup)/config/computed_torque.yaml"/>
<node name="computed_torque_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/ComputedTorqueController -p $(var config) computed_torque_controller"/>
+ args="-p $(var config) computed_torque_controller"/>
<node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
+ args="-p $(find-pkg-share q2d_bringup)/config/joint_state_broadcaster.yaml joint_state_broadcaster"/>
</launch>
<!--******************************************************************************
Quanser 2DSFJE Bringup
- Gazebo Launch File
- Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+ Gazebo Sim Launch File
+ Copyright (C) 2018..2024 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
*******************************************************************************-->
<launch>
- <arg name="pause" default="true"/>
+ <arg name="pause" default="false"/>
<arg name="gui" default="true"/>
<arg name="use_sim_time" default="true"/>
- <arg name="ignition" default="false"/>
<arg name="controller" default="pid"/>
<arg name="config" default="$(find-pkg-share q2d_bringup)/config/$(var controller).yaml"/>
- <include unless="$(var ignition)" file="$(find-pkg-share q2d_description)/launch/gazebo.launch.xml" >
+ <include file="$(find-pkg-share q2d_description)/launch/gazebo.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 if="$(var ignition)" 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)"/>
+++ /dev/null
-<!--******************************************************************************
- Quanser 2DSFJE Bringup
- Group Bypass Controller 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="config" default="$(find-pkg-share q2d_bringup)/config/group_bypass.yaml"/>
-
- <node name="group_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/JointGroupEffortController -p $(var config) group_bypass"/>
-
- <node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
-</launch>
+++ /dev/null
-<!--******************************************************************************
- Quanser 2DSFJE Bringup
- PID Controller 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="config" default="$(find-pkg-share q2d_bringup)/config/group_pid.yaml"/>
-
- <node name="group_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/JointGroupPositionController -p $(var config) group_controller"/>
-
- <node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
-</launch>
<launch>
<arg name="gui" default="true"/>
- <arg name="controller" default="group_bypass"/>
+ <arg name="controller" default="bypass"/>
<arg name="config" default="$(find-pkg-share q2d_bringup)/config/$(var controller).yaml"/>
<include file="$(find-pkg-share q2d_hardware)/launch/controller_manager.launch.xml"/>
<arg name="use_sim_time" value="false"/>
</include-->
- <node name="group_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/JointGroupEffortController $(var controller)"/>
+ <node name="bypass_controller_spawner" pkg="controller_manager" exec="spawner"
+ args="-p $(var config) $(var controller)"/>
<node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
+ args="-p $(find-pkg-share q2d_bringup)/config/joint_state_broadcaster.yaml joint_state_broadcaster"/>
<include if="$(var gui)" file="$(find-pkg-share q2d_description)/launch/display.launch.xml">
<arg name="gui" value="false"/>
<!--******************************************************************************
Quanser 2DSFJE Bringup
PID Controller Launch File
- Copyright (C) 2018, 2021 Walter Fetter Lages <w.fetter@ieee.org>
+ Copyright (C) 2023..2024 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
<launch>
<arg name="config" default="$(find-pkg-share q2d_bringup)/config/pid.yaml"/>
-
- <node name="shoulder_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/JointPositionController -p $(var config) shoulder_controller"/>
-
- <node name="elbow_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/JointPositionController -p $(var config) elbow_controller"/>
+
+ <node name="pid_controller_spawner" pkg="controller_manager" exec="spawner"
+ args="-p $(var config) pid_controller"/>
<node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
+ args="-p $(find-pkg-share q2d_bringup)/config/joint_state_broadcaster.yaml joint_state_broadcaster"/>
</launch>
+++ /dev/null
-<!--******************************************************************************
- Quanser 2DSFJE Bringup
- PID+gravity Controller Launch File
- Copyright (C) 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="config" default="$(find-pkg-share q2d_bringup)/config/pid_plus_gravity.yaml"/>
-
- <node name="pid_plus_gravity_controller_spawner" pkg="controller_manager" exec="spawner"
- args="-t effort_controllers/PidPlusGravityController -p $(var config) pid_plus_gravity_controller"/>
-
- <node name="joint_state_broadcaster_spawner" pkg="controller_manager" exec="spawner"
- args="-t joint_state_broadcaster/JointStateBroadcaster joint_state_broadcaster"/>
-</launch>
#!/usr/bin/python3
import sys
+import array
import rclpy
from rclpy.node import Node
-from std_msgs.msg import Float64
+from control_msgs.msg import MultiDOFCommand
class SquarePublisher(Node):
def __init__(self):
super().__init__('square_publisher')
- self.publisher_=self.create_publisher(Float64,sys.argv[1],1)
- timer_period=float(sys.argv[4])
+ self.publisher_=self.create_publisher(MultiDOFCommand,"/pid_controller/reference",1)
+ timer_period=float(sys.argv[5])
self.timer=self.create_timer(timer_period,self.timer_callback)
self.turn=True;
def timer_callback(self):
- ref=Float64()
- ref.data=float(sys.argv[2] if self.turn else sys.argv[3])
+ ref=MultiDOFCommand()
+ ref.dof_names=["shoulder_active_joint", "elbow_active_joint"]
+ ref.values=[float(sys.argv[1] if self.turn else sys.argv[2]), float(sys.argv[3] if self.turn else sys.argv[4])]
self.turn=not self.turn
self.publisher_.publish(ref)
def main(args=None):
if len(sys.argv) < 5:
- print('square.py topic min max period')
+ print('ijc_square.py shoulder_min shoulder_max elbow_min elbow_max period')
exit()
rclpy.init(args=args)
#!/bin/bash
-ros2 topic pub /shoulder_controller/command std_msgs/msg/Float64 "{data: $1}" -1 &
-ros2 topic pub /elbow_controller/command std_msgs/msg/Float64 "{data: $2}" -1
+if [ "$#" -ne 2 ]; then
+ echo "Usage: $0 <shoulder_angle elbow_angle>>"
+ exit -1;
+fi;
+
+ros2 topic pub /pid_controller/reference control_msgs/msg/MultiDOFCommand "{dof_names: ["shoulder_active_joint", "elbow_active_joint"], values: [$1, $2]}" -1
exit -1;
fi;
-ros2 topic pub /group_controller/commands std_msgs/msg/Float64MultiArray "{data: [$1, $2] }" -1
+ros2 topic pub /bypass_controller/commands std_msgs/msg/Float64MultiArray "{data: [$1, $2] }" -1
ament_lint_auto_find_test_dependencies()
endif()
-ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.dsv.in")
-
ament_package()
--- /dev/null
+- ros_topic_name: "/clock"
+ gz_topic_name: "/clock"
+ ros_type_name: "rosgraph_msgs/msg/Clock"
+ gz_type_name: "ignition.msgs.Clock"
+# subscriber_queue: 5 # Default 10
+# publisher_queue: 6 # Default 10
+# lazy: true # Default "false"
+ direction: GZ_TO_ROS # Default "BIDIRECTIONAL" - Bridge both directions
+ # "GZ_TO_ROS" - Bridge Ignition topic to ROS
+ # "ROS_TO_GZ" - Bridge ROS topic to Ignition
+++ /dev/null
-prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share
-
-set-if-unset;MESA_GL_VERSION_OVERRIDE;3.3
package='tf2_ros',
executable='static_transform_publisher',
name='q2d_origin_publisher',
- arguments=["--frame-id", "map","--child-frame-id","origin_link"]),
+ arguments=["--frame-id", "map","--child-frame-id","World"]),
Node(
package='joint_state_publisher_gui',
executable='joint_state_publisher_gui',
<launch>
<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 pkg="tf2_ros" exec="static_transform_publisher" name="q2d_origin_publisher" args="--frame-id map --child-frame-id World"/>
<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"/>
*******************************************************************************-->
<launch>
- <arg name="pause" default="true"/>
+ <arg name="pause" default="false"/>
<arg name="gui" default="true"/>
<arg name="use_sim_time" default="true"/>
<node name="q2d_spawner" pkg="ros_gz_sim" exec="create" args="-topic robot_description -name q2d"/>
- <node name="clock_bridge" pkg="ros_gz_bridge" exec="parameter_bridge" args="/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock">
+ <node name="ros_gz_bridge" pkg="ros_gz_bridge" exec="parameter_bridge">
+ <param name="config_file" value="$(find-pkg-share q2d_description)/config/gz_bridge.yaml"/>
<param name="use_sim_time" value="$(var use_sim_time)"/>
</node>
</launch>
<xacro:arg name="hardware" default="gazebo"/>
<xacro:property name="hardware" value="$(arg hardware)"/>
+ <link name="World"/>
+
<link name="origin_link"/>
+ <joint name="world_joint" type="fixed">
+ <parent link="World"/>
+ <child link="origin_link"/>
+ </joint>
+
<link name="base_link">
<inertial>
<origin xyz="0.074571214 -0.00008502114 0.039600060500000"/>
<origin xyz="0.267 0 0"/>
</joint>
- <transmission name="shoulder_active_transmission">
- <type>transmission_interface/SimpleTransmission</type>
- <joint name="shoulder_active_joint">
- <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
- </joint>
- <actuator name="shoulder_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- </transmission>
-
- <transmission name="elbow_active_transmission">
- <type>transmission_interface/SimpleTransmission</type>
- <joint name="elbow_active_joint">
- <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
- </joint>
- <actuator name="elbow_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- </transmission>
-
<gazebo reference="base_link">
<visual>
<material>
<ros2_control name="Q2dSystem" type="system">
<xacro:if value="${hardware == 'gazebo'}">
- <!-- Gazebo Sim-->
<hardware>
- <plugin>ign_ros2_control/IgnitionSystem</plugin>
+ <plugin>gz_ros2_control/GazeboSimSystem</plugin>
</hardware>
</xacro:if>
<xacro:if value="${hardware == 'real_robot'}">
- <!-- Actual Hardware -->
<hardware>
<plugin>q2d_hardware/Q2dSystemHardware</plugin>
</hardware>
</ros2_control>
<gazebo>
- <xacro:if value="${hardware == 'gazebo'}">
- <!-- Gazebo Ignition -->
- <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>
- </xacro:if>
+ <plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
+ <parameters>$(find q2d_description)/config/controller_manager.yaml</parameters>
+ </plugin>
</gazebo>
</robot>
<!--
q2d_teleop: A ROS 2 package node to teloperate the Quanser 2DSFJE robot.
- Copyright (c) 2018..2023 Walter Fetter Lages <w.fetter@ieee.org>
+ Copyright (c) 2018..2024 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
-->
<launch>
- <arg name="ignition" default="false"/>
-
<include file="$(find-pkg-share q2d_bringup)/launch/gazebo.launch.xml">
<arg name="pause" value="false"/>
- <arg name="ignition" value="$(var ignition)"/>
</include>
<node name="q2d_teleop_tablet" pkg="q2d_teleop" exec="q2d_teleop_tablet"/>