Slam_Gamapping: No Map recived
Hello everyone,
I've got some problems with the slam_gmapping. First of all, i want to use a Kinect to generate a Map from that data for my robots navigation stack. And navigate in that word/map afterwards. There will be two machines, one for the lowerlevel things like odometry measurement. And one for all the highlevel things like building an map and navigation.
Idea and Structure:
both PC are running ubuntu 16.0.4 and ROS Kinetic
- Robots PC:
- Odometry_publisher (working)
- Motor_control (working)
- freenect driver for the Kinect publishing all the kinect data (working, very slow via wifi; 0.5 fps only)
- Desktop PC:
- pointcloud to laserscan topic (working, very slow due to the slow pointcloud)
- slam_gmapping (proplem see below)
- a tf_broadcaster for all the needed transforming (working)
- the navigation (not working yet. need the map fist)
- Rviz to visualize the process of building the map
Things I've done so far:
Launch-files:
desktop.launch
<launch>
<node pkg="eddie" type="tf_broadcaster" name="tf_broadcaster" output="screen">
<param name="transform_configuration_param" value="param_value" />
</node>
<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
<param name="scan_height" value="10"/>
<remap from="image" to="/camera/depth/image_raw"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping">
<param name="scan" value="scan"/>
<param name="map_update_interval" value="5.0"/>
<param name="maxUrange" value="16.0"/>
<param name="sigma" value="0.05"/>
<param name="kernelSize" value="1"/>
<param name="lstep" value="0.05"/>
<param name="astep" value="0.05"/> <param name="iterations" value="5"/>
<param name="lsigma" value="0.075"/>
<param name="ogain" value="3.0"/>
<param name="lskip" value="0"/> <param name="srr" value="0.1"/>
<param name="srt" value="0.2"/>
<param name="str" value="0.1"/>
<param name="stt" value="0.2"/> <param name="linearUpdate" value="1.0"/>
<param name="angularUpdate" value="0.5"/>
<param name="temporalUpdate" value="3.0"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="30"/>
<param name="xmin" value="-50.0"/>
<param name="ymin" value="-50.0"/>
<param name="xmax" value="50.0"/>
<param name="ymax" value="50.0"/> <param name="delta" value="0.05"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.01"/>
<param name="lasamplerange" value="0.005"/>
<param name="lasamplestep" value="0.005"/>
</node>
eddie.launch
<launch>
<include file="$(find freenect_launch)/launch/freenect.launch"/>
<node pkg="eddie" type="odometry_publisher" name="odometry_publisher" output="screen">
<param name="odom_param" value="param_value" />
</node>
<node pkg="eddie" type="base_control" respawn="false" name="base_control" output="screen">
<rosparam file="$(find navigation)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find navigation)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find navigation)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find navigation)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find navigation)/base_local_planner_params.yaml" command="load" />
</node>
</launch>
I just launch this two files individually on the machines. they work together
- i can see all topics by
rostopic list
- tf-tree is perfectly working. ( transforms for: map->odom->baslink->cameralink->cameraframesxxx)
Problem:
When I start Rviz for visualisation I get the warning: "No map received" I checked following things:
- the slam_gmapping node has subscribed to tf and to the scan topic
- the scan topic is publishing ( can see it in rviz, frame is ok)
- Wifi should be not in overload ( test 13,5Mbits/sec possible; Systemonitor: 3 MiB/s)
- /map topic has no published messages
If i start all nodes on the Robot PC the map is working!
Question
Does anyone have an idea, why the map ist not published correctly when i go thrue the wifi connection? Can i reduce the mass of data sended by the freenect?
Thank you so much! Lorenz
Asked by lorenznew on 2018-07-20 07:27:57 UTC
Answers
This is probably due to the ROS environment variable ROS_HOSTNAME (or ROS_IP, doesn't matter) not properly set. On both PCs, do the following:
- run
ifconfig
to find out the IP of the WiFi interface of that PC (for example192.168.0.101
for the robot PC) -
export ROS_HOSTNAME=192.168.0.101
(or whatever the IP of the WiFi interface of that PC is)
The reason this is necessary is the following: If you don't set the ROS_HOSTNAME
variable, ROS just uses the output of the hostname
command as a default. So for example if your robot PC's hostname is robot-pc
, then the default is ROS_HOSTNAME='robot-pc'
. This means that nodes on your desktop PC will try to connect to that hostname if they subscribe to nodes that are running there. So they essentially try this: ping robot-pc
. For this to work, DNS has to be set up properly, which it often isn't. On the other hand, if you export the ROS_HOSTNAME
variable as I explained above, they'll use the IP address instead of the hostname (like in ping 192.168.0.101
) and that usually works.
Oh, and of course both need to point to the same ROS_MASTER_URI
, but that part seems to be working for you, otherwise rostopic list
wouldn't work.
The gotcha here is that rostopic list
only needs to communicate with the master (so ROS_MASTER_URI
has to be set up properly), but rostopic echo /map
actually needs to communicate peer-to-peer with the other PC, so ROS_HOSTNAME
on the other PC has to be set up properly. Basically everyone runs into this problem at some point, because everything seems to be working, and some topics even come through (depending on where the subscriber and where the publisher is running), but on some topics, the data mysteriously disappears. It's almost always the ROS_HOSTNAME
.
Asked by Martin Günther on 2018-07-20 08:01:30 UTC
Comments
Thanks for our answer!
Interesting, i thought that should be allready working, because i set the host-names and addresses in he /etc/hosts file an both PCs
For example, i can do ssh ros-desktop
and it works.
Or, do i get something wrong?
Asked by lorenznew on 2018-07-23 04:39:38 UTC
You are correct. If you have added the proper IPs to the etc/hosts
file, and ssh using the hostnames works, then setting ROS_HOSTNAME
should not be necessary. Did you try it anyway?
Asked by Martin Günther on 2018-07-24 14:37:55 UTC
hey, no i dont, i think that is not the problem.
I did rostopic echo /tf
and i could see, that the time stamp of my transform base_link -> camera_link is completly different to base_link -> odom
that could bee the problem as well.
Asked by lorenznew on 2018-07-27 04:22:45 UTC
Yep, that will probably be the problem.
Asked by Martin Günther on 2018-07-30 07:55:00 UTC
Comments