Skip to content

Commit

Permalink
Added rootiq
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Delicat <[email protected]>
  • Loading branch information
delihus committed May 8, 2024
1 parent 136fa02 commit 02470cb
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/robotiq_controllers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**:
robotiq_gripper_controller:
ros__parameters:
default: true
joint: robotiq_85_left_knuckle_joint
use_effort_interface: true
use_speed_interface: true

robotiq_activation_controller:
ros__parameters:
default: true
joint: robotiq_85_left_knuckle_joint

4 changes: 4 additions & 0 deletions launch/gz_components.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def get_launch_descriptions_from_yaml_node(
)
)

if component["type"] == "GRP02":
actions.append(get_launch_description("robotiq", package, namespace, component))


return actions


Expand Down
94 changes: 94 additions & 0 deletions launch/gz_robotiq.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright 2024 Husarion sp. z o.o.
#
# 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.

from launch import LaunchDescription
from launch.conditions import IfCondition, UnlessCondition, LaunchConfigurationNotEquals
from launch.actions import DeclareLaunchArgument, LogInfo
from launch_ros.actions import Node
from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from nav2_common.launch import ReplaceString

def generate_launch_description():
robot_namespace = LaunchConfiguration("robot_namespace")
device_namespace = LaunchConfiguration("device_namespace")
tf_prefix = LaunchConfiguration("tf_prefix")

initial_joint_controllers = PathJoinSubstitution(
[FindPackageShare("ros_components_description"), "config", "robotiq_controllers.yaml"]
)

namespace_warn = LogInfo(
msg="Namespace is not implemented with manipulators. Look here: https://github.com/ros-controls/ros2_control/issues/1506",
condition= LaunchConfigurationNotEquals(robot_namespace, "None")
)

# Using tf as namespace is caused by
# https://github.com/ros-controls/ros2_control/issues/1506
# After this fix the device_namespace should be used.
namespaced_initial_joint_controllers_path = ReplaceString(
source_file=initial_joint_controllers,
replacements={
"robotiq_85_left_knuckle_joint": [tf_prefix, "robotiq_85_left_knuckle_joint"],
" robotiq_gripper_controller:": [" ", tf_prefix, "robotiq_gripper_controller:"],
" robotiq_activation_controller:": [" ", tf_prefix, "robotiq_activation_controller:"],
},
)

declare_device_namespace = DeclareLaunchArgument(
"device_namespace",
default_value="",
description="Sensor namespace that will appear before all non absolute topics and TF frames, used for distinguishing multiple cameras on the same robot.",
)

declare_robot_namespace = DeclareLaunchArgument(
"robot_namespace",
default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""),
description="Namespace which will appear in front of all topics (including /tf and /tf_static).",
)

declare_tf_prefix = DeclareLaunchArgument(
"tf_prefix",
default_value="",
description="Prefix added for all links of device. Here used as fix for static transform publisher.",
)

robotiq_gripper_controller = Node(
package="controller_manager",
executable="spawner",
arguments=[
[tf_prefix, "robotiq_gripper_controller"],
"-t",
"position_controllers/GripperActionController",
"-c",
"controller_manager",
"--controller-manager-timeout",
"10",
"--namespace",
device_namespace,
"--param-file",
namespaced_initial_joint_controllers_path,
],
namespace=robot_namespace,
)

return LaunchDescription(
[
declare_device_namespace,
declare_robot_namespace,
declare_tf_prefix,
namespace_warn,
robotiq_gripper_controller,
]
)
5 changes: 5 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<depend>xacro</depend>
<depend>ur_description</depend>
<depend>kortex_description</depend>
<depend>robotiq_description</depend>

<depend condition="($HUSARION_ROS_BUILD_TYPE == simulation) and ($SIMULATION_ENGINE == gazebo-classic)">
gazebo_plugins
Expand All @@ -43,6 +44,10 @@
nav2_common
</depend>

<depend condition="($HUSARION_ROS_BUILD_TYPE == simulation) and ($SIMULATION_ENGINE == ignition-gazebo)">
robotiq_controllers
</depend>

<test_depend>ament_index_python</test_depend>
<test_depend>ament_python_pytest</test_depend>
<test_depend>python-yaml</test_depend>
Expand Down
27 changes: 27 additions & 0 deletions urdf/components.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,33 @@
/>
</xacro:if>

<xacro:if value="${type == 'GRP02'}">
<xacro:include filename="$(find robotiq_description)/urdf/robotiq_2f_85_macro.urdf.xacro"
ns="gripper" />

<xacro:gripper.robotiq_gripper name="${tf_prefix}robotiq_2f_85"
prefix="${tf_prefix}"
parent="${parent_link}"
use_fake_hardware="false"
sim_ignition="true"
>
<origin xyz="${xyz}" rpy="${rpy}" />
</xacro:gripper.robotiq_gripper>
</xacro:if>

<xacro:if value="${type == 'GRP03'}">
<xacro:include filename="$(find robotiq_description)/urdf/robotiq_2f_140_macro.urdf.xacro"
ns="gripper" />

<xacro:gripper.robotiq_gripper name="${tf_prefix}robotiq_2f_140"
prefix="${tf_prefix}"
parent="${parent_link}"
use_fake_hardware="false"
sim_ignition="true"
>
<origin xyz="${xyz}" rpy="${rpy}" />
</xacro:gripper.robotiq_gripper>
</xacro:if>

<xacro:if value="${index}">
<xacro:load_componenet
Expand Down

0 comments on commit 02470cb

Please sign in to comment.