-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
- Loading branch information
1 parent
105c0ba
commit 7b17bcc
Showing
8 changed files
with
257 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
gazebo_ros2_control_demos/config/gripper_controller_effort.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
controller_manager: | ||
ros__parameters: | ||
update_rate: 100 # Hz | ||
|
||
gripper_controller: | ||
type: forward_command_controller/ForwardCommandController | ||
|
||
joint_state_broadcaster: | ||
type: joint_state_broadcaster/JointStateBroadcaster | ||
|
||
gripper_controller: | ||
ros__parameters: | ||
joints: | ||
- right_finger_joint | ||
interface_name: effort |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
gazebo_ros2_control_demos/launch/gripper_mimic_joint_example_position.launch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright 2024 Stogl Robotics Consulting UG (haftungsbeschränkt) | ||
# | ||
# 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. | ||
# | ||
# Author: Denis Stogl | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler | ||
from launch.event_handlers import OnProcessExit | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution | ||
from launch_ros.actions import Node | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
robot_description_content = Command( | ||
[ | ||
PathJoinSubstitution([FindExecutable(name='xacro')]), | ||
" ", | ||
PathJoinSubstitution( | ||
[FindPackageShare( | ||
'gazebo_ros2_control_demos'), | ||
'urdf', | ||
'test_gripper_mimic_joint_position.xacro.urdf'] | ||
), | ||
] | ||
) | ||
robot_description = {"robot_description": robot_description_content} | ||
|
||
node_robot_state_publisher = Node( | ||
package='robot_state_publisher', | ||
executable='robot_state_publisher', | ||
output='screen', | ||
parameters=[robot_description] | ||
) | ||
|
||
gazebo = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource( | ||
[FindPackageShare("gazebo_ros"), "/launch", "/gazebo.launch.py"] | ||
), | ||
) | ||
|
||
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', | ||
arguments=['-topic', 'robot_description', | ||
'-entity', 'gripper'], | ||
output='screen') | ||
|
||
load_joint_state_controller = ExecuteProcess( | ||
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', | ||
'joint_state_broadcaster'], | ||
output='screen' | ||
) | ||
|
||
load_gripper_controller = ExecuteProcess( | ||
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', | ||
'gripper_controller'], | ||
output='screen' | ||
) | ||
|
||
return LaunchDescription([ | ||
RegisterEventHandler( | ||
event_handler=OnProcessExit( | ||
target_action=spawn_entity, | ||
on_exit=[load_joint_state_controller], | ||
) | ||
), | ||
RegisterEventHandler( | ||
event_handler=OnProcessExit( | ||
target_action=load_joint_state_controller, | ||
on_exit=[load_gripper_controller], | ||
) | ||
), | ||
gazebo, | ||
node_robot_state_publisher, | ||
spawn_entity, | ||
]) |
Oops, something went wrong.