Gazebo仿真环境中odom和baselink关联一起

在Gazebo仿真环境中使用slam_gmapping采图时发现,没有odom数据,topic /map没有数据。

通过tf_tree发现。odom没有和base_link建立关联。

在这里插入图片描述

日志上可以看到odom完全没有。
在这里插入图片描述
这需要在gazebo的配置文件中加入下面启动odom的配置

    <broadcastTF>1</broadcastTF>

    <publishOdomTF>true</publishOdomTF>
    <odometryTopic>odom</odometryTopic>
    <odometryFrame>odom</odometryFrame>

此时再看tf tree就能看做所有的位置关系关联再一起了

rosrun rqt_tf_tree rqt_tf_tree

在这里插入图片描述

<xacro:macro name="mbot_base_gazebo"> <link name="base_footprint"> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <box size="0.001 0.001 0.001" /> </geometry> </visual> </link> <gazebo reference="base_footprint"> <turnGravityOff>false</turnGravityOff> </gazebo> <joint name="base_footprint_joint" type="fixed"> <origin xyz="0 0 ${base_length/2 + caster_radius*2}" rpy="0 0 0" /> <parent link="base_footprint"/> <child link="base_link" /> </joint> <link name="base_link"> <visual> <origin xyz=" 0 0 0" rpy="0 0 0" /> <geometry> <cylinder length="${base_length}" radius="${base_radius}"/> </geometry> <material name="yellow" /> </visual> <collision> <origin xyz=" 0 0 0" rpy="0 0 0" /> <geometry> <cylinder length="${base_length}" radius="${base_radius}"/> </geometry> </collision> <xacro:cylinder_inertial_matrix m="${base_mass}" r="${base_radius}" h="${base_length}" /> </link> <gazebo reference="base_link"> <material>Gazebo/Blue</material> </gazebo> <xacro:wheel prefix="left" reflect="1"/> <xacro:wheel prefix="right" reflect="-1"/> <xacro:caster prefix="front" reflect="-1"/> <xacro:caster prefix="back" reflect="1"/> <!-- controller --> <gazebo> <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so"> <update_rate>30</update_rate> <left_joint>left_wheel_joint</left_joint> <right_joint>right_wheel_joint</right_joint> <wheel_separation>${wheel_joint_y*2}</wheel_separation> <wheel_diameter>${2*wheel_radius}</wheel_diameter> <max_wheel_torque>20</max_wheel_torque> <max_wheel_acceleration>1.0</max_wheel_acceleration> <command_topic>cmd_vel</command_topic> <publish_odom>true</publish_odom> <publish_odom_tf>true</publish_odom_tf> <publish_wheel_tf>true</publish_wheel_tf> <odometry_topic>odom</odometry_topic> <odometry_frame>odom</odometry_frame> <robot_base_frame>base_footprint</robot_base_frame> <odometry_source>1</odometry_source> </plugin> </gazebo> </xacro:macro>
03-26
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值