当前位置:网站首页>Gazebo control example
Gazebo control example
2022-07-28 01:19:00 【2021 Nqq】
List of articles
Movement control implementation process
roslaunch urdf02_gazebo demo03_env.launch
start-up gazebo Simulation environment demo03_env.launch
launch file
<launch>
<!-- 1. It needs to be loaded in the parameter server urdf -->
<param name = "robot_description" command = "$(find xacro)/xacro $(find urdf02_gazebo)/urdf/car.urdf.xacro" />
<!-- 2. start-up Gazebo Simulation environment roslaunch gazebo_ros empty_world.launch-->
<include file = "$(find gazebo_ros)/launch/empty_world.launch">
<arg name = "world_name" value = "$(find urdf02_gazebo)/worlds/box_house.world" />
</include>
<!-- 3. stay Gazebo Add robot model in -->
<!-- rosrun gazebo_ros spawn_model -urdf -model mycar -param robot_description , here mycar yes robot name-->
<node pkg = "gazebo_ros" type = "spawn_model" name = "spawn_model" args = "-urdf -model mycar -param robot_description"/>
</launch>
Add drives and controllers move.xacro
<robot name="my_car_move" xmlns:xacro="http://wiki.ros.org/xacro">
<!-- Transmission realization : Used to connect the controller to the joint -->
<xacro:macro name="joint_trans" params="joint_name">
<!-- Transmission is important to link the joints and the controller -->
<transmission name="${joint_name}_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${joint_name}">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${joint_name}_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<!-- Each driving wheel needs to be equipped with a transmission device -->
<xacro:joint_trans joint_name="left2link" />
<xacro:joint_trans joint_name="right2link" />
<!-- controller -->
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<rosDebugLevel>Debug</rosDebugLevel>
<publishWheelTF>true</publishWheelTF>
<robotNamespace>/</robotNamespace>
<publishTf>1</publishTf>
<publishWheelJointState>true</publishWheelJointState>
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<legacyMode>true</legacyMode>
<leftJoint>left2ink</leftJoint> <!-- Left wheel -->
<rightJoint>right2link</rightJoint> <!-- Right wheel -->
<wheelSeparation>${base_radius * 2}</wheelSeparation> <!-- Wheel spacing -->
<wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- Wheel diameter -->
<broadcastTF>1</broadcastTF>
<wheelTorque>30</wheelTorque>
<wheelAcceleration>1.8</wheelAcceleration>
<commandTopic>cmd_vel</commandTopic> <!-- Motion control topics -->
<odometryFrame>odom</odometryFrame> <!-- Coordinate system of odometer -->
<odometryTopic>odom</odometryTopic> <!-- Odometer topic -->
<robotBaseFrame>base_footprint</robotBaseFrame> <!-- Root coordinate system -->
</plugin>
</gazebo>
</robot>
add to xacro Integrated file car.urdf.xacro
<robot name="mycar" xmlns:xacro="http://wiki.ros.org/xacro">
<!-- Contains inertia matrix files -->
<xacro:include filename = "head.xacro" />
<!-- Including chassis 、 camera 、 Radar xacro file -->
<xacro:include filename = "demo02_car_base.urdf.xacro" />
<xacro:include filename = "demo03_car_camera.urdf.xacro" />
<xacro:include filename = "demo04_car_laser.urdf.xacro" />
<!-- Motion control -->
<xacro:include filename = "gazebo/move.xacro" />
</robot>
Rviz Check odometer messages
Odometer : The pose state of the robot relative to the starting point coordinate system (X coordinate Y coordinate Z Coordinates and orientation )
start-up Rviz demo04_sensor.launch
<launch>
<!-- start-up rviz -->
<node pkg = "rviz" type = "rviz" name = "rviz" args = "-d $(find urdf01_rviz)/config/show_mycar.rviz"/>
<!-- Add joint status publishing node -->
<node pkg = "joint_state_publisher" type = "joint_state_publisher" name = "joint_state_publisher" />
<!-- Add robot status publishing node -->
<node pkg = "robot_state_publisher" type = "robot_state_publisher" name = "robot_state_publisher" />
</launch>
source ./devel/setup.bash
roslaunch urdf02_gazebo demo03_env.launch
roslaunch urdf02_gazebo demo04_sensor.launch
Add the component
radar laser.xacro
<robot name="my_sensors" xmlns:xacro="http://wiki.ros.org/xacro">
<!-- radar -->
<gazebo reference="laser"><!-- reference The name should match demo04_car_laser The radar inside has the same name -->
<sensor type="ray" name="rplidar">
<pose>0 0 0 0 0 0</pose><!-- x y z Euler Angle -->
<visualize>true</visualize>
<update_rate>5.5</update_rate>
<ray>
<scan>
<horizontal>
<samples>360</samples> <!-- The radar rotates for one cycle to collect 360 A little bit -->
<resolution>1</resolution><!-- Each line will have a ranging ,2 It means that there will be one ranging for each two lines -->>
<min_angle>-3</min_angle><!-- The unit is radians turn right 3 A radian Clockwise -->
<max_angle>3</max_angle>
</horizontal>
</scan>
<range>
<min>0.10</min><!-- Radar sampling distance -->
<max>30.0</max>
<resolution>0.01</resolution><!-- accuracy -->
</range>
<noise>
<type>gaussian</type><!-- Gauss noise For simulation Simulation error -->
<mean>0.0</mean>
<stddev>0.01</stddev>
</noise>
</ray>
<plugin name="gazebo_rplidar" filename="libgazebo_ros_laser.so">
<topicName>/scan</topicName>
<frameName>laser</frameName><!-- The name should match demo04_car_laser The radar inside has the same name -->
</plugin>
</sensor>
</gazebo>
</robot>
camera camera.xacro
<robot name="my_sensors" xmlns:xacro="http://wiki.ros.org/xacro">
<!-- Quoted link -->
<gazebo reference="camera">
<!-- The type is set to camara -->
<sensor type="camera" name="camera_node">
<update_rate>30.0</update_rate> <!-- The update frequency -->
<!-- Camera basic information settings -->
<camera name="head">
<horizontal_fov>1.3962634</horizontal_fov>
<image>
<width>1280</width>
<height>720</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.02</near>
<far>300</far>
</clip>
<noise>
<type>gaussian</type>
<mean>0.0</mean>
<stddev>0.007</stddev>
</noise>
</camera>
<!-- Core plug-ins -->
<plugin name="gazebo_camera" filename="libgazebo_ros_camera.so">
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>/camera</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>camera</frameName>
<hackBaseline>0.07</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
</plugin>
</sensor>
</gazebo>
</robot>
rostopic pub -r 10 /cmd_vel Set parameters to make the robot rotate
边栏推荐
- Jingfang Technology: ASML, a lithography machine manufacturer, is one of the main customers of Anterion company, which participated in the merger and acquisition of the company
- S-RPN: Sampling-balanced region proposal network for small crop pest detection
- Swoole websocket service
- How to clearly understand and express IAAs, PAAS and SaaS?
- Basic concept and classification of i/o equipment
- Basic use of calculation attributes
- Rviz 使用Arbotix控制机器人运动
- The cooperation between starfish OS and metabell is just the beginning
- Redefine analysis - release of eventbridge real-time event analysis platform
- Vandermond convolution learning notes
猜你喜欢

Fabric2.4.4 version building process (complete process)

从功能测试到自动化测试,月薪突破30K+,我的6年测开经验。

Matlab drawing - points and vectors: method and source code of vector addition and subtraction

Code random notes_ Hash_ 1002 find common characters

Unknown database ‘xxxxx‘

DEMO:测试接口短时间内接收重复数据创建单据

BSP视频教程第21期:轻松一键实现串口DMA不定长收发,支持裸机和RTOS,含MDK和IAR两种玩法,比STM32CubeMX还方便(2022-07-24)
![[300 opencv routines] 241. Scale invariant feature transformation (SIFT)](/img/7a/a764c779c3162920c832325f89f340.png)
[300 opencv routines] 241. Scale invariant feature transformation (SIFT)

Hierarchy of file system
![[STM32] watchdog module](/img/63/346d07c7febbaff69707f47ecb337c.png)
[STM32] watchdog module
随机推荐
uni-app进阶之样式框架/生产环境
范德蒙德卷积 学习笔记
Gossip: an initially perfect FS is as impractical as the first version of the program requiring no bugs
诺基亚宣布与博通合作开发5G芯片
Tool function: pay the non empty field value in one workspace to the same field in another workspace
Code random notes_ Hash_ 1002 find common characters
Data problems can also be found if there is a space at the end of the field value of MySQL query criteria
S-RPN: Sampling-balanced region proposal network for small crop pest detection
晶方科技:光刻机厂商ASML为公司参与并购的Anteryon公司的最主要客户之一
Realize ABCD letter increment
ABAP CDS Table Function介绍与示例
URDF 集成 Gazebo
Oracle error: ora-01722 invalid number
Starfish Os打造的元宇宙生态,跟MetaBell的合作只是开始
Focal Loss讲解
C language programming | explanation and Simulation of offsetof macro
Basic learning of cesium
华米科技“黄山2号”发布:AI性能提升7倍,功耗降低50%!
Analysis and recurrence of network security vulnerabilities
Interface test practical project 02: read interface test documents and practice