当前位置:网站首页>Ros2 self study notes: rviz visualization tool
Ros2 self study notes: rviz visualization tool
2022-07-23 19:09:00 【Raine_ Yang】
start-up rviz
ros2 run rviz2 rviz2
rviz Subscribe to other node topics , Get data , And render the data as an image . stay add Keyhole rviz Many common robot topics have been provided
rviz Display camera picture :
First, in the gazebo Create camera module in
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="camera">
<xacro:macro name="usb_camera" params="prefix:=camera">
<!-- Create laser reference frame -->
<link name="${prefix}_link">
<inertial>
<mass value="0.1" />
<origin xyz="0 0 0" />
<inertia ixx="0.01" ixy="0.0" ixz="0.0"
iyy="0.01" iyz="0.0"
izz="0.01" />
</inertial>
<visual>
<origin xyz=" 0 0 0 " rpy="0 0 0" />
<geometry>
<box size="0.01 0.04 0.04" />
</geometry>
<material name="black"/>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
<geometry>
<box size="0.01 0.04 0.04" />
</geometry>
</collision>
</link>
<gazebo reference="${prefix}_link">
<material>Gazebo/Black</material>
</gazebo>
<gazebo reference="${prefix}_link">
<sensor type="camera" name="camera_node">
<update_rate>30.0</update_rate>
<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>
<plugin name="gazebo_camera" filename="libgazebo_ros_camera.so">
<ros>
<!-- <namespace>stereo</namespace> -->
<remapping>~/image_raw:=image_raw</remapping>
<remapping>~/camera_info:=camera_info</remapping>
</ros>
<camera_name>${
prefix}</camera_name>
<frame_name>${
prefix}_link</frame_name>
<hack_baseline>0.2</hack_baseline>
</plugin>
</sensor>
</gazebo>
</xacro:macro>
</robot>
1 <xacro:macro name="usb_camera" params="prefix:=camera">
Macro definition camera module , name usb_camera, Parameters prefix( Used to complete the name )
2
<visual>
<origin xyz=" 0 0 0 " rpy="0 0 0" />
<geometry>
<box size="0.01 0.04 0.04" />
</geometry>
<material name="black"/>
</visual>
Set the appearance and position of the camera , Box type , black
3 <sensor type="camera" name="camera_node">
Core functions , Set camera properties .sensor Labels are used to identify sensors , The type here is camera
4 <update_rate>30.0</update_rate>
Update rate 30
5 <image> <width>1280</width> <height>720</height> <format>R8G8B8</format> </image>
Set the camera picture width 1280, high 720, Color space type R8G8B8
6 <clip> <near>0.02</near> <far>300</far> </clip>
The upper limit of camera shooting distance 300, Lower limit 0.02
7 <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.007</stddev> </noise>
There may be noise in the picture taken by the real camera , This simulates noise
8
<plugin name="gazebo_camera" filename="libgazebo_ros_camera.so">
<ros>
<!-- <namespace>stereo</namespace> -->
<remapping>~/image_raw:=image_raw</remapping>
<remapping>~/camera_info:=camera_info</remapping>
</ros>
<camera_name>${
prefix}</camera_name>
<frame_name>${
prefix}_link</frame_name>
<hack_baseline>0.2</hack_baseline>
</plugin>
Call the camera driver libgazebo_ros_camera.so, You can redirect the topic name to your own name
Merge the camera with the car body
<?xml version="1.0"?>
<robot name="arm" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find learning_gazebo)/urdf/mbot_base_gazebo.xacro" />
<xacro:include filename="$(find learning_gazebo)/urdf/sensors/camera_gazebo.xacro" />
<xacro:property name="camera_offset_x" value="0.17" />
<xacro:property name="camera_offset_y" value="0" />
<xacro:property name="camera_offset_z" value="0.10" />
<!-- Camera -->
<joint name="camera_joint" type="fixed">
<origin xyz="${camera_offset_x} ${camera_offset_y} ${camera_offset_z}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="camera_link"/>
</joint>
<xacro:usb_camera prefix="camera"/>
<xacro:mbot_base_gazebo/>
</robot>
1 Introduction of camera and car body xacro Model
<xacro:include filename="$(find learning_gazebo)/urdf/mbot_base_gazebo.xacro" />
<xacro:include filename="$(find learning_gazebo)/urdf/sensors/camera_gazebo.xacro" />
2
<xacro:property name="camera_offset_x" value="0.17" />
<xacro:property name="camera_offset_y" value="0" />
<xacro:property name="camera_offset_z" value="0.10" />
Set camera position
3
<joint name="camera_joint" type="fixed">
<origin xyz="${camera_offset_x} ${camera_offset_y} ${camera_offset_z}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="camera_link"/>
</joint>
Use one joint Connect the camera to the body
stay rviz It shows the results
operation :add->image-> stay topic Select the topic name released by the camera 
notes :gazebo and rviz difference
gazebo For the simulation platform , It can be used when there is no physical robot gazebo Simulate robot environment
rviz Display platform for , It can display the obtained two-dimensional or three-dimensional information , The data source can be gazebo It can also be in other ways
边栏推荐
- Understanding and simple implementation of time2vec
- JUC concurrent programming [detailed explanation and demonstration]
- 1259. Disjoint handshake dynamic programming
- How to understand: common code block, construction block, static block? What does it matter?
- Detailed explanation: tmp1750 chip three channel linear LED driver
- JUC并发编程【详解及演示】
- 使用kail破解wifi密码
- Redis [2022 latest interview question]
- Electronic components - resistance
- Access intranet rds+mysql through SSH
猜你喜欢

How can win11 add 3D effects to pictures? Win11 method of adding picture 3D effect

11.神经网络基本概念

How to realize the digital transformation of the banking industry
![[2018] [paper notes] graphene FET and [1] - Types and principles of gfets, characteristics of gfets, applications and principles of gfets in terahertz](/img/df/bc757c7f6f6b801fafdd5a99352ddd.png)
[2018] [paper notes] graphene FET and [1] - Types and principles of gfets, characteristics of gfets, applications and principles of gfets in terahertz

Application of jishili electrometer in testing scheme of new energy battery

Google正在改进所有产品中的肤色表现 践行“图像公平”理念

LM393低功耗双电压比较器参数、引脚、应用详解
![[2020] [paper notes] optically controlled spectral ratio adjustable y based on two-dimensional photonic crystal——](/img/d5/b4c82b2a9b34036e182ea9f1b14618.png)
[2020] [paper notes] optically controlled spectral ratio adjustable y based on two-dimensional photonic crystal——

基於FPGA的UART接口設計

Know two things: how does redis realize inventory deduction and prevent oversold?
随机推荐
MySql【从了解到掌握 一篇就够】
398. Random number index hash table method
Integer and = = compare
integer 和==比较
ROS (27): the simple use of rosparam and the unsuccessful transfer of parameters through launch and its solution
Cell array processing
Clean code and efficient system method
代码整洁,高效的系统方法
Perl语言简述
Multithreading [comprehensive study of graphics and text]
quota的使用方法
lendingclub贷款状态loan status业务详解-current,charge off,issued,Fully Paid,grace period
The first layer of OSI model: physical layer, the cornerstone of existence!
[2020] [paper notes] Based on Rydberg atom——
LM393低功耗双电压比较器参数、引脚、应用详解
ResponseBodyAdvice接口使用导致的报错及解决
What does MySQL access port mean_ What is the port number of the database port
Analysis on the implementation of Flink exactly once delivery
The original path is not original [if there is infringement, please contact the original blogger to delete]
【论文阅读】GETNext: Trajectory Flow Map Enhanced Transformer for Next POI Recommendation