Skip to content

Commit

Permalink
renamed files
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Delicat <[email protected]>
  • Loading branch information
delihus committed Apr 24, 2024
1 parent 557b865 commit 40a99e6
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 27 deletions.
6 changes: 6 additions & 0 deletions config/gz_ouster_os_remappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# https://github.com/ouster-lidar/ouster-ros/blob/ros2/README.md#overview
- ros_topic_name: <robot_namespace><device_namespace>/ouster/points
gz_topic_name: <robot_namespace><device_namespace>/ouster/points/points
ros_type_name: sensor_msgs/msg/PointCloud2
gz_type_name: ignition.msgs.PointCloudPacked
6 changes: 6 additions & 0 deletions config/gz_velodyne_remappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# https://github.com/ros-drivers/velodyne/tree/humble-devel/velodyne_pointcloud#published-topics
- ros_topic_name: <robot_namespace><device_namespace>/velodyne_points
gz_topic_name: <robot_namespace><device_namespace>/velodyne_points/points
ros_type_name: sensor_msgs/msg/PointCloud2
gz_type_name: ignition.msgs.PointCloudPacked
39 changes: 25 additions & 14 deletions launch/gz_components.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,36 @@ def get_value(node: yaml.Node, key: str):
return ""


def get_launch_description(name: str, package: str, namespace: str, component: yaml.Node):
return IncludeLaunchDescription(
PythonLaunchDescriptionSource([package, "/launch/gz_", name, ".launch.py"]),
launch_arguments={
"robot_namespace": namespace,
"device_namespace": get_value(component, "namespace"),
"tf_prefix": get_value(component, "tf_prefix"),
"gz_bridge_name": component["namespace"][1:] + "_gz_bridge",
"camera_name": get_value(component, "name"),
}.items(),
)


def get_launch_descriptions_from_yaml_node(
node: yaml.Node, package: os.PathLike, namespace: str
) -> IncludeLaunchDescription:
actions = []
for component in node["components"]:
actions.append(
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[package, "/launch/", component["type"], ".launch.py"]
),
launch_arguments={
"robot_namespace": namespace,
"device_namespace": get_value(component, "namespace"),
"tf_prefix": get_value(component, "tf_prefix"),
"gz_bridge_name": component["namespace"][1:] + "_gz_bridge",
"camera_name": get_value(component, "name"),
}.items(),
)
)
if component["type"] == "LDR01" or component["type"] == "LDR06":
actions.append(get_launch_description("slamtec_rplidar", package, namespace, component))

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

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

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


return actions

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion launch/LDR06.launch.py → launch/gz_ouster_os.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def generate_launch_description():
ros_components_description = get_package_share_directory("ros_components_description")
gz_bridge_config_path = os.path.join(
ros_components_description, "config", "gz_slamtec_rplidar_remappings.yaml"
ros_components_description, "config", "gz_ouster_os_remappings.yaml"
)

robot_namespace = LaunchConfiguration("robot_namespace")
Expand Down
File renamed without changes.
73 changes: 73 additions & 0 deletions launch/gz_velodyne.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
from launch.substitutions import EnvironmentVariable, LaunchConfiguration
from nav2_common.launch import ReplaceString
from ament_index_python import get_package_share_directory


def generate_launch_description():
ros_components_description = get_package_share_directory("ros_components_description")
gz_bridge_config_path = os.path.join(
ros_components_description, "config", "gz_velodyne_remappings.yaml"
)

robot_namespace = LaunchConfiguration("robot_namespace")
device_namespace = LaunchConfiguration("device_namespace")
gz_bridge_name = LaunchConfiguration("gz_bridge_name")

namespaced_gz_bridge_config_path = ReplaceString(
source_file=gz_bridge_config_path,
replacements={"<robot_namespace>": robot_namespace, "<device_namespace>": device_namespace},
)

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_gz_bridge_name = DeclareLaunchArgument(
"gz_bridge_name",
default_value="gz_bridge",
description="Name of gz bridge node.",
)

gz_bridge = Node(
package="ros_gz_bridge",
executable="parameter_bridge",
name=gz_bridge_name,
parameters=[{"config_file": namespaced_gz_bridge_config_path}],
namespace=robot_namespace,
output="screen",
)

return LaunchDescription(
[
declare_device_namespace,
declare_robot_namespace,
declare_gz_bridge_name,
gz_bridge,
]
)
34 changes: 34 additions & 0 deletions urdf/components.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,40 @@
/>
</xacro:if>

<xacro:if value="${type == 'LDR13'}">
<xacro:include
filename="$(find ros_components_description)/urdf/ouster_os1_32.urdf.xacro"
ns="lidar"
/>

<xacro:lidar.ouster_os1_32
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
tf_prefix="${tf_prefix}"
use_gpu="${use_gpu}"
simulation_engine="${simulation_engine}"
namespace="${fixed_namespace}"
/>
</xacro:if>

<xacro:if value="${type == 'LDR20'}">
<xacro:include
filename="$(find ros_components_description)/urdf/velodyne_puck.urdf.xacro"
ns="lidar"
/>

<xacro:lidar.velodyne_puck
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
tf_prefix="${tf_prefix}"
use_gpu="${use_gpu}"
simulation_engine="${simulation_engine}"
namespace="${fixed_namespace}"
/>
</xacro:if>

<xacro:if value="${index}">
<xacro:load_componenet
counter="${index}"
Expand Down
37 changes: 27 additions & 10 deletions urdf/ouster_os1_32.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
params="parent_link xyz rpy
use_gpu:=false
tf_prefix:=None
topic:=os_lidar
namespace:=None
topic:=ouster/points
frame_id:=os_lidar
simulation_engine:=gazebo-classic">

<xacro:if value="${namespace == 'None'}">
<xacro:property name="ns" value="" />
</xacro:if>
<xacro:unless value="${namespace == 'None'}">
<xacro:property name="ns" value="${namespace}/" />
</xacro:unless>

<xacro:if value="${use_gpu}">
<xacro:property name="ray_type" value="gpu_ray" />
<xacro:property name="plugin_file_name" value="libgazebo_ros_velodyne_gpu_laser.so" />
Expand Down Expand Up @@ -63,7 +71,7 @@
<link name="${prefix}${frame_id}" />

<gazebo reference="${prefix}${frame_id}">
<sensor type="${ray_type}" name="${prefix}ouster_os1_32_sensor">
<sensor type="${ray_type}" name="${ns}${prefix}ouster_os1_32_sensor">
<visualize>false</visualize>
<ray>
<scan>
Expand Down Expand Up @@ -95,14 +103,23 @@

<update_rate>20.0</update_rate>

<plugin name="${prefix}ouster_os1_32_${ray_type}" filename="libgazebo_ros_ray_sensor.so">
<ros>
<namespace></namespace>
<remapping>~/out:=${topic}</remapping>
</ros>
<output_type>sensor_msgs/PointCloud2</output_type>
<frame_name>${prefix}${frame_id}</frame_name>
</plugin>
<xacro:if value="${simulation_engine == 'ignition-gazebo'}">
<topic>${ns}${topic}</topic>
<frame_id>${prefix}${frame_id}</frame_id>
<ignition_frame_id>${prefix}${frame_id}</ignition_frame_id>
<always_on>true</always_on>
</xacro:if>

<xacro:if value="${simulation_engine == 'gazebo-classic'}">
<plugin name="${prefix}ouster_os1_32_${ray_type}" filename="libgazebo_ros_ray_sensor.so">
<ros>
<namespace>${ns}</namespace>
<remapping>~/out:=${topic}</remapping>
</ros>
<output_type>sensor_msgs/PointCloud2</output_type>
<frame_name>${prefix}${frame_id}</frame_name>
</plugin>
</xacro:if>
</sensor>
</gazebo>
</xacro:macro>
Expand Down
4 changes: 2 additions & 2 deletions urdf/velodyne_puck.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
params="parent_link xyz rpy
use_gpu:=false
tf_prefix:=None
topic:=scan
frame_id:=velodyne
namespace:=None
topic:=velodyne_points
frame_id:=velodyne
simulation_engine:=gazebo-classic">

<xacro:if value="${namespace == 'None'}">
Expand Down

0 comments on commit 40a99e6

Please sign in to comment.