-
Notifications
You must be signed in to change notification settings - Fork 18
Feat/Add PointCloud2 sensor #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0"?> | ||
<robot xmlns:xacro="http://ros.org/wiki/xacro"> | ||
|
||
<xacro:macro name="velodyne" params="name parent_link gazebo *origin"> | ||
<xacro:include filename="$(find nav2_minimal_tb4_description)/urdf/icreate/common_properties.urdf.xacro"/> | ||
|
||
<xacro:property name="mass" value="0.17"/> | ||
<xacro:property name="length_x" value="${7.1*cm2m}" /> | ||
<xacro:property name="length_y" value="${10*cm2m}" /> | ||
<xacro:property name="length_z" value="${6*cm2m}" /> | ||
|
||
<xacro:property name="collision_x_offset" value="${0*cm2m}" /> | ||
<xacro:property name="collision_y_offset" value="${1.3*cm2m}" /> | ||
<xacro:property name="collision_z_offset" value="${-1.9*cm2m}" /> | ||
|
||
<joint name="${name}_joint" type="fixed"> | ||
<parent link="${parent_link}"/> | ||
<child link="${name}_link"/> | ||
<xacro:insert_block name="origin"/> | ||
</joint> | ||
|
||
<link name="${name}_link"> | ||
<visual> | ||
<geometry> | ||
<mesh filename="package://nav2_minimal_tb4_description/meshes/rplidar.dae" scale="1 1 1" /> | ||
</geometry> | ||
</visual> | ||
<collision> | ||
<origin xyz="${collision_x_offset} ${collision_y_offset} ${collision_z_offset}"/> | ||
<geometry> | ||
<box size="${length_x} ${length_y} ${length_z}"/> | ||
</geometry> | ||
</collision> | ||
<xacro:inertial_cuboid mass="0.17" x="${length_x}" y="${length_y}" z="${length_z}"/> | ||
</link> | ||
|
||
<gazebo reference="${name}_link"> | ||
<xacro:ray_sensor sensor_name="${name}" use_vertical_rays="true" gazebo="${gazebo}" | ||
update_rate="10.0" visualize="true" | ||
h_samples="360" h_res="1.0" h_min_angle="0.000" h_max_angle="6.280000" | ||
v_samples="180" v_res="0.2" v_min_angle="-0.03" v_max_angle="0.215" | ||
r_min="0.164" r_max="20.0" r_res="0.01"> | ||
<plugin name="dummy" filename="dummyfile"></plugin> | ||
</xacro:ray_sensor> | ||
<xacro:material_darkgray/> | ||
</gazebo> | ||
|
||
<gazebo reference="${name}_joint"> | ||
<preserveFixedJoint>true</preserveFixedJoint> | ||
</gazebo> | ||
|
||
</xacro:macro> | ||
</robot> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ def generate_launch_description(): | |
use_sim_time = LaunchConfiguration('use_sim_time') | ||
namespace = LaunchConfiguration('namespace') | ||
use_simulator = LaunchConfiguration('use_simulator') | ||
use_3dlidar = LaunchConfiguration('use_3dlidar') | ||
robot_name = LaunchConfiguration('robot_name') | ||
# robot_sdf = LaunchConfiguration('robot_sdf') | ||
pose = {'x': LaunchConfiguration('x_pose', default='-8.00'), | ||
|
@@ -51,6 +52,12 @@ def generate_launch_description(): | |
default_value='True', | ||
description='Whether to start the simulator') | ||
|
||
declare_use_3dlidar_cmd = DeclareLaunchArgument( | ||
'use_3dlidar', | ||
default_value='False', | ||
description='Whether to use 3D Lidar and publish pointcloud2' | ||
) | ||
|
||
declare_use_sim_time_cmd = DeclareLaunchArgument( | ||
'use_sim_time', | ||
default_value='true', | ||
|
@@ -78,6 +85,24 @@ def generate_launch_description(): | |
output='screen', | ||
) | ||
|
||
# replace [ros_gz_point_cloud that only works with ign-gazebo <= 2.6.1] | ||
# https://github.com/gazebosim/ros_gz/issues/40 | ||
pcl_bridge = Node( | ||
condition=IfCondition(use_3dlidar), | ||
package='ros_gz_bridge', | ||
executable='parameter_bridge', | ||
name='bridge_ros_gz_pcl', | ||
namespace=namespace, | ||
output='screen', | ||
parameters=[{ | ||
'use_sim_time': use_sim_time, | ||
}], | ||
remappings=[ | ||
('/scan/points', '/pointcloud') | ||
], | ||
arguments=['/scan/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could just add here? https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation/blob/7e9b330d3b10e0617efe576b2e41c01aaa3e6781/nav2_minimal_tb4_sim/configs/tb4_bridge.yaml. Does it hurt to have topics not actually published by GZ on the bridge? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The gazebo topic There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have the 3D lidar publish to a different topic? Overriding |
||
) | ||
|
||
camera_bridge_image = Node( | ||
package='ros_gz_image', | ||
executable='image_bridge', | ||
|
@@ -119,9 +144,11 @@ def generate_launch_description(): | |
ld.add_action(declare_namespace_cmd) | ||
ld.add_action(declare_robot_name_cmd) | ||
ld.add_action(declare_use_simulator_cmd) | ||
ld.add_action(declare_use_3dlidar_cmd) | ||
ld.add_action(declare_use_sim_time_cmd) | ||
|
||
ld.add_action(bridge) | ||
ld.add_action(pcl_bridge) | ||
ld.add_action(camera_bridge_image) | ||
ld.add_action(camera_bridge_depth) | ||
ld.add_action(spawn_model) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these representative of a velodyne sensor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used arbitrary values, while these are the sensor dimensions and specs.
Just providing a template for 3D LIDARs 🥲
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd quickly look up the current specs for a mid-range 3D lidar (that you can actually buy; I think Velodyne brand is end of life?) and update them to be realistic / based on something in particular - especially if we want to take metrics about its performance with respect to! Then, update the name of the file to match that current 3D lidar option