当前位置:网站首页>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
边栏推荐
- Spark 安装与启动
- [attack and defense world web] difficulty Samsung 9-point introductory question (end): Fakebook, favorite_ number
- 基於FPGA的UART接口設計
- Application of jishili electrometer in testing scheme of new energy battery
- Learn about spark project on nebulagraph
- [the whole process of Game Modeling and model production] create the game soldier character with ZBrush
- 迷宫类dp整合
- The first layer of OSI model: physical layer, the cornerstone of existence!
- Redis [super superfine introductory tutorial]
- Conception de l'interface UART basée sur la FPGA
猜你喜欢
![[2020] [paper notes] Based on Rydberg atom——](/img/5c/186cae4e47a236ae4062d15f839196.png)
[2020] [paper notes] Based on Rydberg atom——

基於FPGA的UART接口設計

【2020】【论文笔记】相变材料与超表面——

FPGA实现IIC协议(一)IIC总线协议

Digital security giant entrust revealed that it was attacked by blackmail software gangs in June

Access intranet rds+mysql through SSH
![[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——

Know two things: how does redis realize inventory deduction and prevent oversold?
![[attack and defense world web] difficulty four-star 12 point advanced question: cat](/img/fc/6508c7d534c26f487b0a8ae5be7347.png)
[attack and defense world web] difficulty four-star 12 point advanced question: cat

11.神经网络基本概念
随机推荐
My creation anniversary
What is stack and the difference between stacks
Conception de l'interface UART basée sur la FPGA
jumpserver管理员账号被锁定
什么是堆栈以及堆栈的区别
398. Random number index hash table method
EmguCV 常用函数功能说明「建议收藏」
LM393低功耗双电压比较器参数、引脚、应用详解
CTF misc learning summary "suggestions collection"
DevStack云计算平台快速搭建
Three ways to realize multithreading
Spark installation and startup
PHP file lock lottery to prevent concurrency
It's too strong. An annotation handles the data desensitization returned by the interface
Tcl 语言之Synopsys Tcl篇(3)(数字IC)
Cell array processing
1259. 不相交的握手 動態規劃
Google is improving the skin color performance in all products and practicing the concept of "image fairness"
图的存储结构与方法(二)
Google正在改进所有产品中的肤色表现 践行“图像公平”理念