Skip to content

Instantly share code, notes, and snippets.

@EpsAvlc
Created May 12, 2021 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EpsAvlc/f0c244c9c1c2d19b058698f6252b793d to your computer and use it in GitHub Desktop.
Save EpsAvlc/f0c244c9c1c2d19b058698f6252b793d to your computer and use it in GitHub Desktop.
livox_horizon.urdf.xacro
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:property name="M_PI" value="3.14159"/>
<xacro:property name="laser_min_range" value="0.1"/>
<xacro:property name="laser_max_range" value="200.0"/>
<xacro:property name="horizontal_fov" value="81.7"/>
<xacro:property name="vertical_fov" value="25.1"/>
<xacro:property name="ros_topic" value="livox_lidar/livox"/>
<xacro:property name="samples" value="24000"/>
<xacro:property name="use_inf" value="false"/>
<xacro:property name="downsample" value="2"/>
<xacro:macro name="null_inertial">
<inertial>
<mass value="0.1"/>
<inertia ixx="0.01" ixy="0" ixz="0"
iyy="0.01" iyz="0"
izz="0.01"/>
</inertial>
</xacro:macro>
<xacro:macro name="Livox_Mid_gazebo_sensor" params="visualize:=True update_rate:=10 resolution:=0.002 noise_mean:=0.0 noise_stddev:=0.01 name:=livox">
<gazebo reference="${name}">
<sensor type="ray" name="laser_${name}">
<pose>0 0 0 0 0 0</pose>
<visualize>${visualize}</visualize>
<update_rate>${update_rate}</update_rate>
<!-- This ray plgin is only for visualization. -->
<plugin name="gazebo_ros_laser_controller" filename="liblivox_laser_simulation.so">
<ray>
<scan>
<horizontal>
<samples>100</samples>
<resolution>1</resolution>
<min_angle>${-horizontal_fov/360*M_PI}</min_angle>
<max_angle>${horizontal_fov/360*M_PI}</max_angle>
</horizontal>
<vertical>
<samples>50</samples>
<resolution>1</resolution>
<min_angle>${-vertical_fov/360*M_PI}</min_angle>
<max_angle>${vertical_fov/360*M_PI}</max_angle>
</vertical>
</scan>
<range>
<min>${laser_min_range}</min>
<max>${laser_max_range}</max>
<resolution>${resolution}</resolution>
</range>
<noise>
<type>gaussian</type>
<mean>${noise_mean}</mean>
<stddev>${noise_stddev}</stddev>
</noise>
</ray>
<visualize>${visualize}</visualize>
<samples>${samples}</samples>
<downsample>${downsample}</downsample>
<csv_file_name>package://livox_laser_simulation/scan_mode/horizon.csv</csv_file_name>
<ros_topic>${ros_topic}</ros_topic>
<use_inf>${use_inf}</use_inf>
</plugin>
</sensor>
</gazebo>
</xacro:macro>
<xacro:macro name="Livox_HORIZON" params="visualize:=True name:=livox">
<link name="${name}_base">
<xacro:null_inertial/>
<visual>
<origin xyz="0.00 0 0.00" rpy="0 0 0"/>
<geometry>
<mesh filename="package://livox_laser_simulation/meshes/livox_mid40.dae">
</mesh>
</geometry>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh
filename="package://livox_laser_simulation/meshes/livox_mid40.dae">
</mesh> </geometry>
</collision>
</link>
<link name="${name}">
<xacro:null_inertial/>
</link>
<joint name="${name}_to_${name}_base_joint" type="fixed">
<parent link="${name}_base"/>
<child link="${name}"/>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
</joint>
<xacro:Livox_Mid_gazebo_sensor name="${name}" visualize="${visualize}"/>
</xacro:macro>
<!-- <xacro:Livox_HORIZON name="livox"/> -->
<!-- <xacro:include filename="$(find livox_laser_simulation)/urdf/standardrobots_oasis300.xacro"/>
<xacro:link_oasis name="oasis"/> -->
</robot>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment