Hello I am trying to get a map of the area with a differential drive mobile robot, for which the following are the steps followed.
-
Open the kinect with openini using "roslaunch openni_launch openni.launch".
-
Change the pointcloud to the laser scan using "rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw", after step-2 I am able to see the "laser scan" in the RVIz properly.
Running the gmapping with "rosrun gmapping slam_gmapping scan:=/scan tf:=/odom" , I am running the node which publishes the odom (the odometry data from the real robot).
Then open rviz with "rosrun rviz rviz".
But in RVIZ I am unable to see any mapping.
Questions:
The procedure which I follwed is correct or Is there something I am missing..?
For publishing the odo data I am using the example from the following link: http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom with the following changes:
- Added a callback, so as to subscribe to the incoming data from the robot.
- Changed the velocities to suit for differential drive robot.
- Small change in calculation of the robot position based on odo.
But the odom published from this has many fields:
nav_msgs::Odometry odom;
odom.header.stamp = current_time;
odom.header.frame_id = "odom";
//set the position
odom.pose.pose.position.x = x;
odom.pose.pose.position.y = y;
odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation = odom_quat;
//set the velocity
odom.child_frame_id = "base_link";
odom.twist.twist.linear.x = vx;
odom.twist.twist.linear.y = vy;
odom.twist.twist.angular.z = vth;
which one I should give to the gmapping...?
Please find the rqt_graph here
Please find the frames.pdf here
Many thanks in advance
Originally posted by sumanth on ROS Answers with karma: 86 on 2014-08-13
Post score: 1
Original comments
Comment by bvbdort on 2014-08-13:
share your rqt_graph here in question
Comment by sumanth on 2014-08-13:
I am unable to attach the rqt_graph here because of lack of points!!
Comment by bvbdort on 2014-08-13:
i did upvote, try now if its possible. or use http://imgur.com/
Comment by sumanth on 2014-08-13:
I have modified the question
Comment by bvbdort on 2014-08-13:
you can see from image that odom is not published . publish Odom and start gmapping like "rosrun gmapping slam_gmapping scan:=scan _odom_frame:=/odom"
Comment by sumanth on 2014-08-13:
Its getting published, I have reuploaded the rqt_graph.
but how to link the odom to the gmapping...?
Comment by bvbdort on 2014-08-13:
rosrun gmapping slam_gmapping scan:=scan odom_frame:=/odom
Comment by sumanth on 2014-08-13:
No its not geeting linked, you can check the rqt_graph
Comment by bvbdort on 2014-08-13:
try rosrun gmapping slam_gmapping scan:=scan odom_frame:=/odom (i removed underscrore _ )
Comment by sumanth on 2014-08-13:
Still NO luck.
Comment by sumanth on 2014-08-13:
In Rviz, what should I select in fixed frame and what should I add to see the mapping in Rviz.
Comment by sumanth on 2014-08-13:
But Gmapping documentation say
<
the frame attached to incoming scans> → base_link
usually a fixed value, broadcast periodically by a robot_state_publisher, or a tf static_transform_publisher.
base_link → odom
usually provided by the odometry system (e.g., the driver for the mobile base)
Comment by sumanth on 2014-08-13:
how to give these tf's
Comment by bvbdort on 2014-08-13:
in RVIZ select map as frame in global option; check the laser frame id by "rostopic echo /scan " and add in launch file.
Comment by sumanth on 2014-08-13:
I can see data when I echo the topic /scan, even launched the file with static transform.
But still I am unable to see anything on the RVIZ.
Comment by sumanth on 2014-08-13:
same old problem topic /odom is not getting linked to the gmapping.
Comment by bvbdort on 2014-08-13:
rosrun tf view_frames , share the frames.pdf picture. wht is the frame id ur getting for laser scan ?
Comment by sumanth on 2014-08-14:
@bvbdort: I have modified the question with frames.pdf.
Comment by bvbdort on 2014-08-14:
i cannt see the static publisher in frames.odf, what is ur laser scan frame id ? i guess it is camera_depth_optical_frame. so run
Comment by sumanth on 2014-08-14:
I have followed ahendrix answer and changed the scanner link name to camera_link in the URDF file,
Then it staretd to map.
Comment by sumanth on 2014-08-14:
so now I need to change in the launch file as
<node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0 0 0 0 0 0 base_link camera_link 100"/>
Is this correct..???
Comment by bvbdort on 2014-08-14:
yes add above line in your launch file.