“第一个测试检查里程表旋转的合理程度。我打开rviz,将框架设置为“ odom”,显示激光扫描机器人提供的功能,将该主题的衰减时间设置得很高(大约20秒),然后执行就地旋转。然后,我看一下扫描在随后的旋转中相互匹配的紧密程度。理想情况下,扫描会正确彼此重叠,但预计会有一些旋转漂移,因此我只确保扫描距离不超过一两个度。(“导航堆栈调整”)“
”表示激光雷达数据应该在旋转之前,期间和之后大致位于同一位置。我一直在阅读,看来我看到的这些漩涡是正确的吗?我一直在尝试在模拟中使用gmapping,并且每当旋转地图时,都会被严重毁容-我相信里程表应归咎于此。
我已经记录了odom框架中的激光雷达数据。这是正确的还是应该看起来有所不同?
我按照本教程构建了初始模型并进行了仿真。我创建了一个(视觉上)粗糙的模型,该模型具有两个可移动的轮子(左和右)和两个使用其通用框架的无摩擦脚轮(前后)。我改变了机器人的形状,但只是按照他们的程序进行操作,并试图复制它。我试图将左轮和右轮的x旋转从-pi / 2翻转到pi / 2,这只是反转了运动方向,这是我期望的,但是并没有改变odom框架中条纹激光雷达的问题。我很困惑,因为直线测距数据将激光扫描保持在相同的位置(就像人们期望的那样),但是当我旋转机器人时,会出现条纹。我真的不知道在凉亭中计算里程表数据的机制,所以我坚持解决此问题。
urdf文件如下所示:
<?xml version="1.0"?>
<robot name="bender" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:property name="pi" value="3.141592653589794" />
<xacro:property name="base_len" value="0.89" />
<xacro:property name="base_wid" value="0.80" />
<xacro:property name="base_height" value="0.20" />
<xacro:property name="caster_length" value="0.10" />
<xacro:property name="caster_radius" value="0.15" />
<xacro:property name="wheel_length" value="0.10" />
<xacro:property name="wheel_radius" value="0.15" />
<xacro:property name="update_rate" value="50"/>
<xacro:property name="hokuyo_size" value="0.05"/>
<xacro:macro name="default_inertial" params="mass">
<inertial>
<mass value="${mass}" />
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0" />
</inertial>
</xacro:macro>
<material name="white">
<color rgba="1 1 1 1.5"/>
</material>
<link name="base_link">
<visual>
<geometry>
<box size="${base_len} ${base_wid} ${base_height}"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<geometry>
<box size="${base_len} ${base_wid} ${base_height}"/>
</geometry>
</collision>
<xacro:default_inertial mass="1"/>
</link>
<xacro:macro name="caster" params="position reflect">
<joint name="${position}_wheel_joint" type="fixed">
<parent link="base_link"/>
<child link="${position}_wheel"/>
<axis xyz="0 0 1"/>
<origin xyz="${reflect*(base_wid/2)} 0 ${-1 * base_height}" rpy="${pi/2} 0 0"/>
</joint>
<link name="${position}_wheel">
<visual>
<geometry>
<sphere radius="${caster_radius}"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<geometry>
<sphere radius="${caster_radius}"/>
</geometry>
</collision>
<xacro:default_inertial mass="0.5"/>
</link>
<!-- This block provides the simulator (Gazebo) with information on a few additional
physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
<gazebo reference="${position}_wheel">
<mu1 value = "0.0"/>
<mu2 value = "0.0"/>
<kp value = "10000000.0"/>
<kd value = "1.0"/>
<material>Gazebo/Grey/</material>
</gazebo>
</xacro:macro>
<xacro:macro name="wheel" params="position reflect">
<joint name="${position}_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="${position}_wheel"/>
<axis xyz="0 0 1"/>
<origin xyz="0 ${reflect*(base_wid/2)} ${-1*base_height}" rpy="${-pi/2} 0 0"/>
</joint>
<link name="${position}_wheel">
<visual>
<geometry>
<cylinder length = "${wheel_length}" radius="${wheel_radius}"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<geometry>
<cylinder length = "${wheel_length}" radius="${wheel_radius}"/>
</geometry>
</collision>
<xacro:default_inertial mass="0.5"/>
</link>
<!-- This block provides the simulator (Gazebo) with information on a few additional
physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
<gazebo reference="${position}_wheel">
<mu1 value = "200.0"/>
<mu2 value = "100.0"/>
<kp value="1000000.0" />
<kd value="1.0" />
<fdir1 value="1 0 0"/>
<material>Gazebo/Grey/</material>
</gazebo>
<!-- This block connects the wheel joint to an actuator (motor), which informs both
simulation and visualization of the robot -->
<transmission name="${position}_wheel_trans">
<type>transmission_interface/SimpleTransmission</type>
<actuator name="${position}_wheel_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
<joint name="${position}_wheel_joint">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
</transmission>
</xacro:macro>
<!-- Creating the actual robot -->
<xacro:caster position="front" reflect="1"/>
<xacro:caster position="back" reflect="-1"/>
<xacro:wheel position="right" reflect="1"/>
<xacro:wheel position="left" reflect="-1"/>
<!-- Gazebo plugin for ROS Control -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
<!-- Hokuyo Laser Senso -->
<link name="hokuyo_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="${hokuyo_size} ${hokuyo_size} ${1.5*hokuyo_size}"/>
</geometry>
<material name="Blue" />
</visual>
</link>
<joint name="hokuyo_joint" type="fixed">
<origin xyz="${base_wid/2} 0 ${base_height+hokuyo_size/4}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="hokuyo_link" />
</joint>
<gazebo reference="hokuyo_link">
<material>Gazebo/Blue</material>
<turnGravityOff>false</turnGravityOff>
<sensor type="ray" name="head_hokuyo_sensor">
<pose>${hokuyo_size/2} 0 0 0 0 0</pose>
<visualize>false</visualize>
<update_rate>40</update_rate>
<ray>
<scan>
<horizontal>
<samples>720</samples>
<resolution>1</resolution>
<min_angle>-1.570796</min_angle>
<max_angle>1.570796</max_angle>
</horizontal>
</scan>
<range>
<min>0.10</min>
<max>10.0</max>
<resolution>0.001</resolution>
</range>
</ray>
<plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
<topicName>/scan</topicName>
<frameName>hokuyo_link</frameName>
</plugin>
</sensor>
</gazebo>
</robot>
我按照教程中的说明设置了差动驱动控制器,并使用了自己的值,在这里:
type: "diff_drive_controller/DiffDriveController"
publish_rate: 50
left_wheel: ['left_wheel_joint']
right_wheel: ['right_wheel_joint']
# Odometry covariances for the encoder output of the robot. These values should
# be tuned to your robot's sample odometry data, but these values are a good place
# to start
pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.0 # default: 1.0
wheel_radius_multiplier : 1.0 # default: 1.0
# Top level frame (link) of the robot description
base_frame_id: base_link
# Velocity and acceleration limits for the robot
# default min = -max
linear:
x:
has_velocity_limits : true
max_velocity : 5.0 # m/s
has_acceleration_limits: true
max_acceleration : 0.6 # m/s^2
angular:
z:
has_velocity_limits : true
max_velocity : 1.0 # rad/s
has_acceleration_limits: true
max_acceleration : 0.5 # rad/s^2
has_jerk_limits : true
max_jerk : 2.5 # rad/s^3
我将wheel_separation和wheel_radius留在了外面,因为我希望它们能够自动生成。我输入了不同的值,包括我认为的值,并且从odom框架看时它不会改变激光雷达数据的条纹。
编辑:
我已经从ROS机器人项目书中编译并运行了代码。第9章代码中有一个模拟机器人。我将固定框架置于odom,当我向前移动时,在x方向上有“条纹”,但在旋转时却没有。这对我来说很有意义,但我想知道为什么我的模拟机器人不会表现出这种行为。
#1 楼
这可能有点迟了,但我希望对以后学习ros的人们有所帮助。首先,在URDF模型中,
将mu1和mu2的摩擦系数设置为0。
如果车轮没有摩擦系数,则没有摩擦。
因此,车轮将不会移动,因为它没有摩擦,请将其设置为非零,它将移动。
其次,在diff_drive(yaml)文件中
pose_covariance_diagonal和twist_covariance对角线必须设置。
请参阅https://docs.ros.org/api/geometry_msgs/html/msg/PoseWithCovariance.html
和TwistWithCovariance。
如何
数字越大,对特定矩阵的影响越大。
1.1 1.2 1.3
2.1 2.2 2.3 2.3
1.1 = x到x。
等...
协方差矩阵解释-> https://manialabs.wordpress.com/2012/08/06/covariance-matrices-wit h-a-practical-example /