Ask Your Question
0

draw the path with hector slam

asked 2016-05-22 05:47:49 -0600

aziz gravatar image

hello every one, I am using the hector slam with hokuyo. i do have have the map but i need to see the path of the robot on Rviz can anyone help me please

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2016-05-24 01:24:58 -0600

gp gravatar image

updated 2016-06-09 01:06:37 -0600

To get the trajectory, you have to initialize hector_trajectory_server node.To do this you can directly call "geotiff_mapper.launch" file in "hector_geotiff" package. After launching this node, to visualize the path in rviz add "Path" and select topic as /trajectory.

Edit:

Working Launch files

hector_hokuyo.launch

    <launch>
  <param name="pub_map_odom_transform" value="true"/> 
  <param name="map_frame" value="map"/> 
  <param name="base_frame" value="base_frame"/> 
  <param name="odom_frame" value="odom"/>

  <node pkg="hokuyo_node" type="hokuyo_node" name="hokuyo_node"/>
  <node pkg="tf" type="static_transform_publisher" name="map_2_odom" args="0 0 0 0 0 0 /map /odom 100"/>
  <node pkg="tf" type="static_transform_publisher" name="odom_2_base_footprint" args="0 0 0 0 0 0 /odom /base_footprint 100"/>
  <node pkg="tf" type="static_transform_publisher" name="base_footprint_2_base_link" args="0 0 0 0 0 0 /base_footprint /base_link 100"/> 
  <node pkg="tf" type="static_transform_publisher" name="base_link_2_base_stabilized_link" args="0 0 0 0 0 0 /base_link /base_stabilized 100"/> 
  <node pkg="tf" type="static_transform_publisher" name="base_stablized_2_base_frame" args="0 0 0 0 0 0 /base_stabilized /base_frame 100"/> 
  <node pkg="tf" type="static_transform_publisher" name="base_frame_2_laser_link" args="0 0 0 0 0 0 /base_frame /laser 100"/> 
  <node pkg="tf" type="static_transform_publisher" name="base_2_nav_link" args="0 0 0 0 0 0 /base_frame /nav 100"/>

  <node pkg="rviz" type="rviz" name="rviz" args="-d <path_to_folder>/rviz_cfg.rviz"/>

  <include file="<path_to_folder>/default_mapping.launch"/> 
  <include file="<path_to_folder>/geotiff_mapper.launch"/>

</launch>

default_mapping.launch

<launch>
  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_frame"/>
  <arg name="odom_frame" default="base_frame"/>
  <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.9" />    
    <param name="map_update_distance_thresh" value="0.4"/>
    <param name="map_update_angle_thresh" value="0.06" />
    <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>

  <!--<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 map nav 100"/>-->
</launch>

geotiff_mapper.launch

<launch>
  <arg name="trajectory_source_frame_name" default="/scanmatcher_frame"/>
  <arg name="trajectory_update_rate" default="4"/>
  <arg name="trajectory_publish_rate" default="0.25"/>
  <arg name="map_file_path" default="$(find hector_geotiff)/maps"/>
  <arg name="map_file_base_name" default="hector_slam_map"/>

  <node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen">
    <param name="target_frame_name" type="string" value="/map" />
    <param name="source_frame_name" type="string" value="$(arg trajectory_source_frame_name)" />
    <param name="trajectory_update_rate" type="double" value="$(arg trajectory_update_rate)" />
    <param name="trajectory_publish_rate" type ...
(more)
edit flag offensive delete link more

Comments

I did what you told me but i still don't have the path, do i need to set any parameter on "geotiff_mapper.launch" file ?

aziz gravatar imageaziz ( 2016-05-24 14:13:08 -0600 )edit

Can you please share your launch files or elaborate what procedure you are following. In "geotiff_mapper.launch" file, you will need to set argument "trajectory_source_frame_name" to tf for which you want to visualize the path.

gp gravatar imagegp ( 2016-05-25 03:45:53 -0600 )edit

its working , thank you a lot , you saved me

aziz gravatar imageaziz ( 2016-06-09 07:11:32 -0600 )edit

You are welcome. hey accept the answer as correct by clicking the tick mark :)

gp gravatar imagegp ( 2016-06-09 07:34:54 -0600 )edit
0

answered 2016-05-25 05:22:45 -0600

aziz gravatar image

first i run the file of hokuyo and hector_mapping that i obtained here

https://github.com/DaikiMaekawa/hecto...

and than i run the launch file provided in the hector_mapping package

<launch> <arg name="trajectory_source_frame_name" default="/base_link"/> <arg name="trajectory_update_rate" default="4"/> <arg name="trajectory_publish_rate" default="0.25"/> <arg name="map_file_path" default="$(find hector_geotiff)/maps"/> <arg name="map_file_base_name" default="hector_slam_map"/>

<node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen"> </node>

<node pkg="hector_geotiff" type="geotiff_node" name="hector_geotiff_node" output="screen" launch-prefix="nice -n 15"> <remap from="map" to="/dynamic_map"/> </node>

</launch<>

edit flag offensive delete link more

Comments

Use hector_hokuyo.launch file at launcher. Set arg "trajectory_source_frame_name" as "scanmatcher_frame" in the geotiff_mapper.launch file. It would be better to make a copy of "geotiff_mapper.launch" in your local folder use that.

gp gravatar imagegp ( 2016-05-26 03:42:15 -0600 )edit

Did you get it?

gp gravatar imagegp ( 2016-05-30 02:50:00 -0600 )edit

no, I didn't . i don't see any path with rviz

aziz gravatar imageaziz ( 2016-06-08 06:02:59 -0600 )edit

i have added launch files in my answer. These are working for me. Save these in any folder with same file names, edit "path_to_folder" in hector_hokuyo.launch and just launch the file 'hector_hokuyo.launch' it will initialise hokuyo, hector_slam node , rviz and also display the path in the map.

gp gravatar imagegp ( 2016-06-09 00:51:06 -0600 )edit
0

answered 2016-05-22 12:05:51 -0600

wsAndy gravatar image

hello you could use another package named hector_trajectory_server. You could also find many information in hector_slam

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-22 05:47:49 -0600

Seen: 1,174 times

Last updated: Jun 09 '16