ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Can I rely on the navigation tutorials when working with sonar?

asked 2016-04-07 00:41:26 -0500

mukut_noob gravatar image

updated 2016-04-07 00:42:32 -0500

Hello, I have setup a robot running Ubuntu 14.04 on a Raspberry Pi 2 with Ros indigo. I want my robot to make a map of the surroundings and then navigate in it. I have Sonar and not laser scanners.

This Ros tutorial about publishing sensor streams over Ros assume that the robot is using a laser but what if it is using a Sonar?

Here's the link : http://wiki.ros.org/navigation/Tutori...

Do I need to write the code myself?

If I need, then where to write? Do I write it just similar to the one described in the tutorial? And how do I mention the gpio pin numbering and all those for my rpi to understand?

Please help and correct me if I am wrong.

Thanks & Regards Mukut

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
3

answered 2016-04-07 02:30:40 -0500

Procópio gravatar image

Short answer: yes, you can!

In Ros, the navigation packages requires a costmap to work. This costmap can be built using different sensors, as LIDARs, RGBD cams, infrareds, sonars, etc... The sensor of choice will affect the quality of your costmap and therefore, the quality of your navigation.

If you need to create your own driver for your ultrasound sensor, you need to populate and publish a range message. I believe you can follow the mentioned tutorial to get an idea on how to construct and populate a message, but changing the type from LaserScan to a Range message.

edit flag offensive delete link more

Comments

Okay thank you so much!! I will try it out and let you know....thank you!

mukut_noob gravatar image mukut_noob  ( 2016-04-07 02:34:26 -0500 )edit

So I need to follow and use those parameters and write my own code? Right? So can it be in python? Please correct me if I am wrong.

mukut_noob gravatar image mukut_noob  ( 2016-04-07 02:51:36 -0500 )edit

yes, you can use python. what you have to do is to get the raw info from your sonar, use it to populate your range message and publish it. by doing that you will have a node that will publish your sonar data as a ros topic, which can be used by many other nodes.

Procópio gravatar image Procópio  ( 2016-04-07 04:23:05 -0500 )edit

@Humpelstilzchen post is very useful on what you can do after having that topic and effectively using it for navigation.

Procópio gravatar image Procópio  ( 2016-04-07 04:24:06 -0500 )edit

But are there some detailed guide on how to populate the range and publish it? Or can you tell a little? It would help a lot.

mukut_noob gravatar image mukut_noob  ( 2016-04-07 05:16:19 -0500 )edit

you can get the idea of how to populate a ros message from the tutorial you mentioned in your question.

Procópio gravatar image Procópio  ( 2016-04-07 08:21:26 -0500 )edit

So I can use any editor and write the code, then save it in my catkin workspace under sensor_msgs and then include it in the launch file that would populate the message and send it over Ros. Right?

mukut_noob gravatar image mukut_noob  ( 2016-04-07 09:33:44 -0500 )edit

no, that's not the way. forget about ros for a while. what you need is a code that will get the data from a sensor, using whatever means you have available, and populate a message structure and publish it. i suggest you go back to more basic tutorials before advancing on this issue.

Procópio gravatar image Procópio  ( 2016-04-08 05:31:58 -0500 )edit
2

answered 2016-04-07 02:22:19 -0500

Humpelstilzchen gravatar image

You are asking multiple questions, please split them, I will focus on the navigation part:

Sonar probably just won't work since they cover a large area, a single Bottle will mark a large area as occupied, what you can do is

  1. configure the costmap to use Range Sensor Layer instead of the usual laser based obstacle_layer. See the the Layered costmap tutorial on how to do that.
  2. Do not use amcl/gmapping and use /odom as the global frame.
  3. Paint the map yourself with e.g. Inkscape and feed that to the map

Afaik there currently is no single tutorial for this, so this requires a lot of reading, it probably would be a good idea to write one.

edit flag offensive delete link more

Comments

Okay thank you so much!! I will try it out and let you know....thank you!

mukut_noob gravatar image mukut_noob  ( 2016-04-07 02:35:04 -0500 )edit

U mean I should not use gmapping package? Then what shall I use in order to make the robot I told earlier?

mukut_noob gravatar image mukut_noob  ( 2016-04-07 05:14:59 -0500 )edit

gmapping is to record a map from Laserscan, without one you can only manually paint one.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2016-04-07 05:29:27 -0500 )edit

Okok...so in that case I need to use something like lnkspace?

mukut_noob gravatar image mukut_noob  ( 2016-04-07 07:12:23 -0500 )edit

Lnkscape* are there any tutorials on it?

mukut_noob gravatar image mukut_noob  ( 2016-04-07 07:14:08 -0500 )edit

Inkscape was just an example, just use your favorite painting program to draw the lines for the walls etc. But thats the least of your problems now, you should focus on the other parts, e.g. publishing sonar data first.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2016-04-07 08:15:40 -0500 )edit

Ohh...okay..

mukut_noob gravatar image mukut_noob  ( 2016-04-07 09:27:08 -0500 )edit
0

answered 2016-04-07 02:05:26 -0500

Orhan gravatar image

If your Sonar isn't very very good, You can't make a reliable map with it. You should write code for converting sonar data to laser scans. And you may need more sonars.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-04-07 00:41:26 -0500

Seen: 1,695 times

Last updated: Apr 07 '16