How to map with hector_mapping and just a Lidar
Hi, I just got a lidar (ydlidar x4), and would like to use it to map (just holding the lidar and raspberry pi myself and walk around the room without odometry)..I'm very new to ROS. I have read quite a lot posts...but still could fix the errors..
The lidar is connected to raspberry pi 3, and the scanning data is successfully shown in rviz. But as I tried with hector _slam, I got an error:
[ INFO] [1539142958.281154496]: lookupTransform base_link to laser_frame timed out. Could not transform laser scan into base_frame.
[ WARN] [1539142958.855603123]: No transform between frames /map and /base_link available after 20.009138 seconds of waiting. This warning only prints once.
To start with hector_slam, I roslaunch the all_node.launch file (from another tutorial) below:
<launch>
<include file="$(find ydlidar)/launch/lidar.launch" />
<node pkg="tf" type="static_transform_publisher" name="map_to_odom"
args="0.0 0.0 0.0 0 0 0.0 /odom /base_link 40" />
<node pkg="tf" type="static_transform_publisher" name="base_frame_laser"
args="0.0 0.0 0.0 0 0 0.0 /base_link /laser_frame 40" />
<include file="$(find hector_mapping)/launch/mapping_default.launch" />
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find ydlidar)/launch/lidar.rviz" />
<include file="$(find hector_geotiff)/launch/geotiff_mapper.launch" />
</launch>
While for the mapping default.launch:
<?xml version="1.0"?>
<launch>
<arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
<arg name="base_frame" default="base_link"/>
<arg name="odom_frame" default="base_link"/>
<arg name="pub_map_odom_transform" default="true"/>
<arg name="scan_subscriber_queue_size" default="5"/>
<arg name="scan_topic" default="scan"/>
<arg name="map_size" default="2048"/>
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
<!-- Frame names -->
<param name="map_frame" value="map" />
<param name="base_frame" value="$(arg base_frame)" />
<param name="odom_frame" value="$(arg odom_frame)" />
<!-- Tf use -->
<param name="use_tf_scan_transformation" value="true"/>
<param name="use_tf_pose_start_estimate" value="false"/>
<param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>
<!-- Map size / start point -->
<param name="map_resolution" value="0.050"/>
<param name="map_size" value="$(arg map_size)"/>
<param name="map_start_x" value="0.5"/>
<param name="map_start_y" value="0.5" />
<param name="map_multi_res_levels" value="2" />
<!-- Map update parameters -->
<param name="update_factor_free" value="0.4"/>
<param name="update_factor_occupied" value="0.7" />
<param name="map_update_distance_thresh" value="0.2"/>
<param name="map_update_angle_thresh" value="0.9" />
<param name="laser_z_min_value" value = "-1.0" />
<param name="laser_z_max_value" value = "1.0" />
<!-- Advertising config -->
<param name="advertise_map_service" value="true"/>
<param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
<param name="scan_topic" value="$(arg scan_topic)"/>
<!-- Debug parameters -->
<!--
<param name="output_timing" value="false"/>
<param name="pub_drawings" value="true"/>
<param name="pub_debug_output" value="true"/>
-->
<param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
</node>
</launch>
For your information, here's my tf tree:
Please, anyone knows how to solve this?
=========================================================
After changing the all_nodes.launch file:
<launch>
<include file="$(find ydlidar)/launch/lidar.launch" />
<node pkg="tf" type="static_transform_publisher" name="map_to_odom"
args="0.0 0.0 0.0 0 0 0.0 /odom /map 40" />
<node pkg="tf" type="static_transform_publisher" name="odom_to_baselink"
args="0.0 0.0 0.0 0 0 0.0 /odom /base_link 40" />
<node pkg="tf" type="static_transform_publisher" name="base_frame_laser"
args="0.0 0.0 ...
@IvyKK: in the future: could you please attach images directly to your posts? That way the question is not dependent on the existence of some off-site file (or file hosting company).
I've give you enough karma to do that yourself, but I've already done it here.
@gvdhoorn: Thank you so much!! Yes, I tried to upload the pic, but found that I didn't have enough karma. Thanks for offering!
hi can you plz help me build the same projekt