ROS TF坐标变换

维护管理TF树

查看tf树

rosrun rqt_tf_tree rqt_tf_tree

amcl.launch文件中内容

这里就涉及map->odom->base_footprint坐标变换



<launch>
    <arg name="init_x" default="0" />
    <arg name="init_y" default="0" />
    <arg name="init_a" default="0" />

    <node pkg="amcl" type="amcl" name="amcl" output="screen">
        
        <param name="transform_tolerance" value="0.2" />
        <param name="gui_publish_rate" value="10.0"/>
        <param name="laser_max_beams" value="30"/>
        <param name="min_particles" value="100"/>
        <param name="max_particles" value="5000"/>
        <param name="kld_err" value="0.01"/>
        <param name="kld_z" value="0.99"/>
        
        <param name="odom_alpha1" value="0.2"/>
        <param name="odom_alpha2" value="0.2"/>
        <param name="odom_alpha3" value="0.8"/>
        <param name="odom_alpha4" value="0.2"/>
        <param name="laser_z_hit" value="0.5"/>
        <param name="laser_z_short" value="0.05"/>
        <param name="laser_z_max" value="0.05"/>
        <param name="laser_z_rand" value="0.5"/>
        <param name="laser_sigma_hit" value="0.2"/>
        <param name="laser_lambda_short" value="0.1"/>
        <param name="laser_lambda_short" value="0.1"/>
        <param name="laser_model_type" value="likelihood_field"/>

        
        <param name="laser_likelihood_max_dist" value="2.0"/>
        <param name="update_min_d" value="0.1"/>
        <param name="update_min_a" value="0.1"/>
        <param name="resample_interval" value="2"/>
        <param name="transform_tolerance" value="0.1"/>
        <param name="recovery_alpha_slow" value="0.0"/>
        <param name="recovery_alpha_fast" value="0.1"/>

        <param name="use_map_topic" value="true"/>
        <param name="first_map_only" value="true"/>
        <param name="tf_broadcast" value="true"/>

        <param name="odom_frame_id" value="odom"/>
        <param name="global_frame_id" value="map"/>
        <param name="base_frame_id" value="base_footprint"/>
        <param name="odom_model_type" value="diff"/>

        <param name="initial_pose_x" value="$(arg init_x)"/>
        <param name="initial_pose_y" value="$(arg init_y)"/>
        <param name="initial_pose_a" value="$(arg init_a)"/>
        <param name="initial_cov_xx" value="0.25" />
        <param name="initial_cov_yy" value="0.25" />
        <param name="initial_cov_aa" value="0.2" />
    node>
launch>

雷达的launch文件内容



<launch>
    <node name="ls01b_v2" pkg="ls01b_v2" type="ls01b_v2" output="screen">
        <param name="scan_topic" value="scan"/>         #设置激光数据topic名称
        <param name="frame_id" value="laser_link"/>     #激光坐标
        <param name="serial_port" value="/dev/laser"/>  #雷达连接的串口
        <param name="baud_rate" value="460800" />        #雷达连接的串口波特率
        <param name="angle_resolution" value="0.25"/>     #雷达角度分辨率
        <param name="zero_as_max" value="false"/>        # 设置为true探测不到区域会变成最大值
        <param name="min_as_zero" value="false"/>        # true:探测不到区域为0,false:探测不到区域为inf
        <param name="rpm" value="600"/>                 # 雷达转速
        <param name="angle_compensate" value="true"/>                 # 角度补偿,非同轴
        <rosparam file="$(find ls01b_v2)/launch/includes/filter.yaml" command="load"/>
    node>
launch>

发布tf变换的launch文件内容

<launch>
    <node pkg="tf" type="static_transform_publisher" name="base_footprint2base_link" args="0.0 0.0 0.15 0.0 0.0 0.0 /base_footprint /base_link 10"/>
    <node pkg="tf" type="static_transform_publisher" name="base_link2laser_link" args=" 0.07 0.0 0.0 0.0 0.0 0.0 /base_link /laser_link 10"/>
    <node pkg="tf" type="static_transform_publisher" name="base_link2imu" args="0.1653 0.0 0.0 0.0 0.0 0.0 /base_link /IMU_link 10"/>
</launch>

这样的话,tf树就这样
map->odom->base_footprint->base_link->laser_link
ROS TF坐标变换_第1张图片

你可能感兴趣的:(ROS,ROS,TF,坐标变换)