diff --git a/launch/gz_components.launch.py b/launch/gz_components.launch.py index be683cf..8b4a783 100644 --- a/launch/gz_components.launch.py +++ b/launch/gz_components.launch.py @@ -88,6 +88,7 @@ def get_launch_descriptions_from_yaml_node( "GRP02": "robotiq", # "GRP03": "robotiq", Waiting for release # https://github.com/PickNikRobotics/ros2_robotiq_gripper/blob/main/robotiq_description/urdf/robotiq_2f_85_macro.urdf.xacro + "WCH02": "wibotic_station", } for component in node["components"]: diff --git a/launch/gz_wibotic_station.launch.py b/launch/gz_wibotic_station.launch.py new file mode 100644 index 0000000..1997f0e --- /dev/null +++ b/launch/gz_wibotic_station.launch.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +# 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. + +import os +import yaml + +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, OpaqueFunction +from launch.substitutions import ( + EnvironmentVariable, + LaunchConfiguration, +) +from launch_ros.actions import Node + + +def launch_setup(context, *args, **kwargs): + components_config_path = LaunchConfiguration("components_config_path").perform(context) + robot_namespace = LaunchConfiguration("robot_namespace") + device_namespace = LaunchConfiguration("device_namespace") + + components_config = None + if components_config_path == "None": + return [] + + with open(os.path.join(components_config_path)) as file: + components_config = yaml.safe_load(file) + + actions = [] + + for component in components_config["components"]: + component_type = component["type"] + if component_type == "WCH02": + + component_xyz = [x for x in component["xyz"].split()] + component_rpy = [x for x in component["rpy"].split()] + + spawn_station = Node( + package="ros_gz_sim", + executable="create", + arguments=[ + "-name", + [robot_namespace, "_", device_namespace, "_station"], + "-topic", + "station_description", + "-x", + component_xyz[0], + "-y", + component_xyz[1], + "-z", + component_xyz[2], + "-R", + component_rpy[0], + "-P", + component_rpy[1], + "-Y", + component_rpy[2], + ], + namespace=robot_namespace, + emulate_tty=True, + ) + + actions.append(spawn_station) + + return actions + + +def generate_launch_description(): + declare_components_config_path_arg = DeclareLaunchArgument( + "components_config_path", + default_value="None", + description=( + "Additional components configuration file. Components described in this file " + "are dynamically included in Panther's urdf." + "Panther options are described here " + "https://husarion.com/manuals/panther/panther-options/" + ), + ) + + 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).", + ) + + return LaunchDescription( + [ + declare_components_config_path_arg, + declare_device_namespace, + declare_robot_namespace, + OpaqueFunction(function=launch_setup), + ] + ) diff --git a/meshes/wibotic_receiver.stl b/meshes/wibotic_receiver.stl new file mode 100644 index 0000000..d1473fe Binary files /dev/null and b/meshes/wibotic_receiver.stl differ diff --git a/meshes/wibotic_station.stl b/meshes/wibotic_station.stl new file mode 100644 index 0000000..e107593 Binary files /dev/null and b/meshes/wibotic_station.stl differ diff --git a/urdf/components.urdf.xacro b/urdf/components.urdf.xacro index 7e63aa3..16c4c09 100644 --- a/urdf/components.urdf.xacro +++ b/urdf/components.urdf.xacro @@ -268,6 +268,20 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/urdf/wibotic_station.urdf.xacro b/urdf/wibotic_station.urdf.xacro new file mode 100644 index 0000000..cfc87c3 --- /dev/null +++ b/urdf/wibotic_station.urdf.xacro @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 1.0 1.0 1 + 0.6 0.6 0.6 1 + 1.0 1.0 1.0 + true + 0 0 0 1 + + + $(arg apriltag_image_path) + + + + + + + + + + + + + +