ROS交流群
ROS Group 产品服务
Product Service 开源代码库
Github 官网
Official website 技术交流
Technological exchanges 激光雷达
LIDAR ROS教程
ROS Tourials 深度学习
Deep Learning 机器视觉
Computer Vision
ROS Group 产品服务
Product Service 开源代码库
Github 官网
Official website 技术交流
Technological exchanges 激光雷达
LIDAR ROS教程
ROS Tourials 深度学习
Deep Learning 机器视觉
Computer Vision
ros中camera传感器仿真无法正常发送图片话题
-
版本:ubuntu20.04 ros1
我在solidworks中建立了机器人模型并输出了urdf文件。<?xml version="1.0" encoding="utf-8"?> <!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578 For more information, please see http://wiki.ros.org/sw_urdf_exporter --> <robot name="3d_print_robot_model"> <link name="base_link"> <inertial> <origin xyz="0.19898390423237 0.136295828839814 0.0559696626408911" rpy="0 0 0" /> <mass value="1.57046726571518" /> <inertia ixx="0.0161662239279828" ixy="-4.51732951485129E-08" ixz="4.53270639100012E-07" iyy="0.0069929467963612" iyz="-2.83217287565168E-08" izz="0.0221140119223207" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/base_link.STL" /> </geometry> <material name=""> <color rgba="0.776470588235294 0.756862745098039 0.737254901960784 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/base_link.STL" /> </geometry> </collision> </link> <link name="trans1"> <inertial> <origin xyz="0.251041515587677 -0.020143080425782 -0.0239546550789421" rpy="0 0 0" /> <mass value="1.27430857423357" /> <inertia ixx="0.00142116644244525" ixy="7.61020229656834E-08" ixz="-4.38157220825767E-08" iyy="0.0178126840190855" iyz="-0.00034411056257697" izz="0.0174663670074097" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans1.STL" /> </geometry> <material name=""> <color rgba="0.627450980392157 0.627450980392157 0.627450980392157 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans1.STL" /> </geometry> </collision> </link> <joint name="trans1j" type="prismatic"> <origin xyz="-0.097806 0.26668 0.19086" rpy="0 0 0" /> <parent link="base_link" /> <child link="trans1" /> <axis xyz="0 -1 0" /> <limit lower="-0.1" upper="0.3" effort="100" velocity="1" /> </joint> <link name="trans2"> <inertial> <origin xyz="0.0274040137942429 -0.0130854946724574 -0.0963303271399604" rpy="0 0 0" /> <mass value="0.340507075853314" /> <inertia ixx="0.000710350535613184" ixy="6.45300313054141E-07" ixz="-5.41413301944147E-07" iyy="0.000885240004833508" iyz="-2.5310686133709E-07" izz="0.00020549973328961" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans2.STL" /> </geometry> <material name=""> <color rgba="0.627450980392157 0.627450980392157 0.627450980392157 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans2.STL" /> </geometry> </collision> </link> <joint name="trans2j" type="prismatic"> <origin xyz="0.23825 -0.01882 0.13574" rpy="0 0 0" /> <parent link="trans1" /> <child link="trans2" /> <axis xyz="-1 0 0" /> <limit lower="-0.2" upper="0.2" effort="100" velocity="1" /> </joint> <link name="trans3"> <inertial> <origin xyz="0.000409660273492346 0.0225705291571963 -0.0822632214009157" rpy="0 0 0" /> <mass value="0.222484066630729" /> <inertia ixx="0.000109697390742199" ixy="3.44372047080085E-07" ixz="-2.4816924229294E-10" iyy="0.000256232209662399" iyz="-6.5646480077053E-10" izz="0.000246948709210129" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans3.STL" /> </geometry> <material name=""> <color rgba="0.509803921568627 0.509803921568627 0.588235294117647 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/trans3.STL" /> </geometry> </collision> </link> <joint name="trans3j" type="prismatic"> <origin xyz="0.028832 -0.081699 -0.055943" rpy="0 0 0" /> <parent link="trans2" /> <child link="trans3" /> <axis xyz="0 0 -1" /> <limit lower="-0.1" upper="0.05" effort="100" velocity="1" /> </joint> <link name="ror"> <inertial> <origin xyz="-7.89010088469988E-06 -2.21880413486808E-07 0.0901578124971945" rpy="0 0 0" /> <mass value="0.291525306330778" /> <inertia ixx="0.000391685635976909" ixy="-3.40344185301567E-09" ixz="1.24543651227828E-07" iyy="0.000391752179776028" iyz="-9.49073079659087E-11" izz="9.82239673904642E-05" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/ror.STL" /> </geometry> <material name=""> <color rgba="0.627450980392157 0.627450980392157 0.627450980392157 1" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://3d_print_robot_model/meshes/ror.STL" /> </geometry> </collision> </link> <joint name="rorj" type="revolute"> <origin xyz="0 0 -0.16563" rpy="0 0 0" /> <parent link="trans3" /> <child link="ror" /> <axis xyz="0 0 1" /> <limit lower="-3.14" upper="3.14" effort="100" velocity="1" /> </joint> </robot>
在其上加入了摄像头部件的物理信息xacro文件
<!-- 摄像头相关的 xacro 文件 --> <robot name="my_camera" xmlns:xacro="http://wiki.ros.org/xacro"> <!-- 摄像头属性 --> <xacro:property name="camera_length" value="0.001" /> <!-- 摄像头长度(x) --> <xacro:property name="camera_width" value="0.001" /> <!-- 摄像头宽度(y) --> <xacro:property name="camera_height" value="0.001" /> <!-- 摄像头高度(z) --> <xacro:property name="camera_x" value="0.00390" /> <!-- 摄像头安装的x坐标 --> <xacro:property name="camera_y" value="-0.00670" /> <!-- 摄像头安装的y坐标 --> <xacro:property name="camera_z" value="0.01307" /> <!-- 摄像头安装的z坐标 --> <!-- 摄像头关节以及link --> <link name="camera_link"> <visual> <geometry> <box size="${camera_length} ${camera_width} ${camera_height}" /> </geometry> <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> </visual> <inertial> <mass value="0.1"/> <inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001"/> </inertial> </link> <joint name="camera2base_link" type="fixed"> <parent link="ror" /> <child link="camera_link" /> <origin xyz="${camera_x} ${camera_y} ${camera_z}" /> </joint> </robot>
以及传感器插件xacro文件
<?xml version="1.0"?> <robot name="my_sensors" xmlns:xacro="http://ros.org/wiki/xacro"> <!-- camera --> <gazebo reference="camera_link"> <sensor type="camera" name="camera_sensor"> <update_rate>30.0</update_rate> <camera> <horizontal_fov>1.3962634</horizontal_fov> <image> <width>800</width> <height>800</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="camera_controller" filename="libgazebo_ros_camera.so"> <alwaysOn>true</alwaysOn> <updateRate>30.0</updateRate> <cameraName>robot/camera</cameraName> <imageTopicName>image_raw</imageTopicName> <cameraInfoTopicName>camera_info</cameraInfoTopicName> <frameName>camera_link</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>
组装的xacro文件
<robot name="my_robot" xmlns:xacro="https://wiki.ros.org/xacro"> <xacro:include filename="$(find 3d_print_robot_model)/xacro/robot.xacro"/> <xacro:include filename="$(find 3d_print_robot_model)/xacro/camera.xacro"/> <!--gazebo仿真文件--> <xacro:include filename="$(find 3d_print_robot_model)/xacro/g_camera.xacro"/> <!-- xacro:include filename="ros_control.xacro"/>--> <!--xacro:include filename="deepcamera.xacro"/>--> <!-- <xacro:include filename="laser_gazebo.xacro"/> --> </robot>
上述代码中,camera的图片信息回发布在image_raw主题中,但实际运行时通过查找rostopic list发现该话题并未发布。
在rviz当中机器人的物理信息也完全显示出来,没有问题。
请问这是什么原因造成的呢?