# Sonar Board Test fails:

**URL:** <https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536>\
**Category:** General Questions\
**Created:** [May 27, 2020, 6:29pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536 "2020-05-27T18:29:21Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![rohbotics](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/rohbotics/32/222_2.png) [@rohbotics](https://forum.ubiquityrobotics.com/u/rohbotics)\
**Post date:** [July 2, 2020, 3:30am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/21 "2020-07-02T03:30:14Z")

</div>

Hi @johnnyv,

We did quite a few changes to the way pi\_sonar works, you can get it from source here: [https://github.com/UbiquityRobotics/pi\_sonar](https://github.com/UbiquityRobotics/pi_sonar).

I think we still need to do a sync before this is available as an apt update/upgrade.

---

<div class="post-metadata">

**Author:** ![johnnyv](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@johnnyv](https://forum.ubiquityrobotics.com/u/johnnyv)\
**Post date:** [July 4, 2020, 9:33am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/22 "2020-07-04T09:33:32Z")

</div>

Thanks @rohbotics  
Any instructions for syncing? Otherwise I’ll probably overwrite the system ros libs

---

<div class="post-metadata">

**Author:** ![johnnyv](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@johnnyv](https://forum.ubiquityrobotics.com/u/johnnyv)\
**Post date:** [July 5, 2020, 7:14am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/23 "2020-07-05T07:14:22Z")

</div>

Just a follow up, it worked fine to install pi\_sonar into my catkin\_ws and then catkin\_make. It seems that magni robot will use those packages over the ones installed

---

<div class="post-metadata">

**Author:** ![rohbotics](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/rohbotics/32/222_2.png) [@rohbotics](https://forum.ubiquityrobotics.com/u/rohbotics)\
**Post date:** [July 7, 2020, 3:52am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/24 "2020-07-07T03:52:53Z")

</div>

Yes the catkin\_ws packages override the system installed ones.

Sorry if I wasn’t clear about the sync, that is something that needs to be done on our side, but we haven’t done adequate testing yet. Thanks for letting us know that it works for you!

Rohan

---

<div class="post-metadata">

**Author:** ![omar](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/o/f0a364/32.png) [@omar](https://forum.ubiquityrobotics.com/u/omar)\
**Post date:** [September 1, 2020, 10:00am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/25 "2020-09-01T10:00:54Z")

</div>

Hello. I am having similar issue where it will just hang at rostopic echo /sonars as per below snapshot.  
Can you advise how do I update the pi\_sonar package?

 ![IMG_1362](https://forum.ubiquityrobotics.com/uploads/default/original/1X/444f607829865a8a954062915d8c0636556b167c.jpeg)

Regards,  
omar

---

<div class="post-metadata">

**Author:** ![omar](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/o/f0a364/32.png) [@omar](https://forum.ubiquityrobotics.com/u/omar)\
**Post date:** [September 3, 2020, 4:27am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/26 "2020-09-03T04:27:52Z")

</div>

Hello Ubiquity team, do you have some software diagnostic step to rule out hardware or software issue? Re-seating the ribbon-cable connectors doesn’t help.  
Appreciate the support!

Rgds,  
omar

---

<div class="post-metadata">

**Author:** ![omar](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/o/f0a364/32.png) [@omar](https://forum.ubiquityrobotics.com/u/omar)\
**Post date:** [September 4, 2020, 12:09pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/27 "2020-09-04T12:09:00Z")

</div>

Finally got the sonar working!  
Followed what johnnyv did by installing pi\_sonar from [GitHub - UbiquityRobotics/pi\_sonar: Package that provides a ROS interface for the sonar array in UbiquityRobotics robots · GitHub](https://github.com/UbiquityRobotics/pi_sonar)  
into my catkin\_ws and then catkin\_make.

 ![magnisonar](https://forum.ubiquityrobotics.com/uploads/default/original/1X/12351a552b46f3e3eeb09de45b267f85bf82a51d.jpeg)

---

<div class="post-metadata">

**Author:** ![FFelizpe](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@FFelizpe](https://forum.ubiquityrobotics.com/u/FFelizpe)\
**Post date:** [December 21, 2020, 6:44pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/28 "2020-12-21T18:44:57Z")

</div>

Hello there!

I’m currently having the same kind of problem here with my Magni. The sonar topics (/sonars, /sonar\_0, /sonar\_1, etc) don’t publish any kind of information, just staying as a blank line. We’ve tried here going through all the things that were said in this thread, but we’re not sure yet of what could the problem be.

- The raspicam is working, as the sonars are receiving 5V in the Vcc pins, so we don’t believe that it is a problem in the ribbon cable.
- The pi\_sonar has been cloned from git, and we have compiled it through catkin\_make already.
- We’re using a Rasp4, though we’re not sure if that interferes or not.

Does anybody know what could the problem be? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [December 23, 2020, 10:40am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/29 "2020-12-23T10:40:59Z")

</div>

We had run into a problem with Pi4 and had to fix it in the more recent images we have posted on our site here: [https://downloads.ubiquityrobotics.com/pi.html](https://downloads.ubiquityrobotics.com/pi.html)

This was Pi4 specific problem with the GPIO control which is used for sonar control.

The 2020-11-07 darn well better have the fix or we need to know it does not have the fixes.

I will assume you have properly enabled the sonars in /etc/robot.yaml and if not please see this page:

> **[Camera and Sonar Board Installation](https://learn.ubiquityrobotics.com/camera_sensors)**
>
> Tutorials for Magni

---

<div class="post-metadata">

**Author:** ![FFelizpe](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@FFelizpe](https://forum.ubiquityrobotics.com/u/FFelizpe)\
**Post date:** [January 14, 2021, 12:52pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/30 "2021-01-14T12:52:24Z")

</div>

Hi! Sorry, got on a break through the holidays and I ended up not seeing the response, my apologies.

We checked here, and we are on the most recent image already, and it’s not working. We have enabled the sonars in the robot.yaml through this page, yes.

Something we noticed try to solder new ultrasonic sensors, to see if that could help, is that the solder pad is almost without metal, and it’s really hard to really get tin in place while soldering, so I’m not sure if it’s a hardware or a software problem anymore - though that would have to be affecting all five sensors, then. Thanks, in any case!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 23, 2021, 9:03am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/31 "2021-01-23T09:03:52Z")

</div>

FFelizpe: Can you switch over to this more current thread for sonars with Pi4:

> [@Sonar sensors not functioning](https://frm.ubiquityrobotics.com/t/sonar-sensors-not-functioning/709/5):
>
> Whenever you start ROS a new set of logs get generated in home folder under .ros/log The directory names are long unique strings so there is a shortcut setup for current log. This folder holds the latest or current logs on magni: /home/ubuntu/.ros/log Instead of editing just now lets just search the main log called rosout.log for sonar info: grep -i sonar /home/ubuntu/.ros/log/latest/rosout.log For the ros log you can edit it I will use vi below but you may replace ‘vi’ with nano if you …

This is being reported by multiple users. I am going to contact Rohan who is our expert on the Pi4 GPIO changes which are critical for Sonars. He posted in this thread in July 2020 so I thought our most recent image from Nov of last year addressed this issue but perhaps not.

So use that thread and I’ll post there. it may be that even with Nov 2020 image still we need the apt upgrade. I will be trying it myself likely tomorrow.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 25, 2021, 1:55am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/32 "2021-01-25T01:55:33Z")

</div>

I have posted a ‘beta’ fix that I will be doing more testing on to see if this fix impacts some other GPIO port features besides Sonar.  
If you want a Sonar Fix now and are up for helping me test this STILL BETA fix for other side effects then please see entry today from me in the forum thread I wish to be the new master for Sonar board issues that is here: [Sonar sensors not functioning](https://frm.ubiquityrobotics.com/t/sonar-sensors-not-functioning/709) Thanks, Mark

---

<div class="post-metadata">

**Author:** ![inmoov](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/inmoov/32/473_2.png) [@inmoov](https://forum.ubiquityrobotics.com/u/inmoov)\
**Post date:** [April 12, 2021, 11:27pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/33 "2021-04-12T23:27:03Z")

</div>

Hi @mjstn2011,All

Since this thread is about Sonars, I will ask my questions here regarding it,

1. I tried “set way point” on your Robot Commander app, setting like from A to B point , question is does the Sonar gets activated straight away to avoid obstacles ? Because Magni just runs into things from A to B …

2. Also I tried running Magni\_Lidar with a map and also move\_basic, Does the Sonar run automatically as well to avoid obstacles ? Because say if I set a goal for Magni to go , it goes but if there are obstacles like a chair leg , table leg … it just runs into them blindly

Please help…,

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 13, 2021, 2:33am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/34 "2021-04-13T02:33:08Z")

</div>

Please check the enhanced section for troubleshooting the sonar board. Verify that your sonar board is functioning in middle of this page [https://learn.ubiquityrobotics.com/sonar\_sensors](https://learn.ubiquityrobotics.com/sonar_sensors)

The Robot Commander I ‘thought’ used our move\_basic module which is ‘supposed to’ watch for object directly in front using middle sonar sensor. This would not work if the sonars were not operating.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 13, 2021, 2:36am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/35 "2021-04-13T02:36:28Z")

</div>

You have discussed object detect also with magni lidar. I answer that now.

A week or so back I made a separate node that with current ubiquity\_motor node code and this new node the middle 3 sonars stop the robot to avoid collision. The do not do ‘recovery’ to automatically move around the object, the node just tries to prevent a collision till you move the object yourself.

See this repository: [https://github.com/UbiquityRobotics/sonar\_detector](https://github.com/UbiquityRobotics/sonar_detector)

Read the readme carefully!

---

<div class="post-metadata">

**Author:** ![inmoov](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/inmoov/32/473_2.png) [@inmoov](https://forum.ubiquityrobotics.com/u/inmoov)\
**Post date:** [April 14, 2021, 1:15am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/36 "2021-04-14T01:15:13Z")

</div>

@mjstn2011, All

ok, the Sonars seems to be working fine thks (rostopic echo /sonars returned the 5 sonars and their ranges)  
but only works at a certain height because of the way it is designed to mount, so in my test, anything under the eye level of the sonars, it couldnt detect and it will just crash it…, (with the two front wheels). is it possible that I can add more sonars at the front bottom (I see holes at the front plate)? and do you sell extension Sonar boards?

another question is, in the (link below), it mentioned this [`exit_collision_on_reverse` (int, default: 1) When set non-zero the robot is allowed to only backup once collision active state is entered.] , because at the moment, Magni’s sonars detects say an obstacle and it just stuck there facing it , if is something light, I can take it away and it continues to move but if if it’s a stationary Wall, Magni just stuck there (saying waiting for obstacle…)…any ways around this?

1. where and how can I change the `exit_collision_on_reverse` parameter?

2. is it set to default value 1 ? (in the Magni raspberri pi image)

3. since /Sonar and /Pi\_sonar 0 to 4 has appeared in rostopic list (when I run the move\_basic) , do I still need to follow the instructions in the link below to [git clone [GitHub - UbiquityRobotics/ubiquity\_motor: Package that provides a ROS interface for the motors in UbiquityRobotics robots](https://github.com/UbiquityRobotics/ubiquity_motor)] and do a catkin\_make?

4. also I’m using “Set Waypoint” function in the RobotCommander app, from say point A to B to C, if I place an obstacle between A and B, it detects it and stops in front of it and then it just “stuck” there…, so I tell it to go to C, and Magni turns itself around (dont care on what is at the back of it …so from this action, Magni’s back hits other things which it does not see on its back…, before going to C…which it failed to do so…because it’s back hit something …while turning itself around). My point here is that it seems Magni does not know how to reverse (given by the Sonars telling it there is obstacle in front of it), it kinds of ignores it and turns itself around (obviously, the back is going to hit the obstacle) and tries to reach another point… , is there a way around this please?

> [@mjstn2011](#):
>
> [GitHub - UbiquityRobotics/sonar\_detector](https://github.com/UbiquityRobotics/sonar_detector)

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [April 14, 2021, 6:49am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/37 "2021-04-14T06:49:10Z")

</div>

Correct in that the sonars only detect for something within a narrow ‘cone’ of around +/- 25 degrees from the centerline of the sonar board. That is all that sonars can do. They are limited in that way.

Second and other parts of your question:

- Default for exit\_collision\_on\_reverse is 1 already.

To answer your other questions I have updated the README in the sonar\_detector repository so you can cd ~/catkin\_ws/src/sonar\_detector and then use ‘git pull’

Please see that to answer your questions and in this way other people will also have the document that was not full enough to answer your questions.

---

<div class="post-metadata">

**Author:** ![inmoov](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/inmoov/32/473_2.png) [@inmoov](https://forum.ubiquityrobotics.com/u/inmoov)\
**Post date:** [May 7, 2021, 1:17pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/38 "2021-05-07T13:17:24Z")

</div>

Hi @mjstn2011

I notice that I still have questions from my previous post not answered, can you please advise?

1. 

> [@inmoov](#):
>
> is it possible that I can add more sonars at the front bottom (I see holes at the front plate) and all around Magni? and do you sell ‘extension’ Sonar boards? if not, where do I connect the extra ultrasonic sensors on the “main board”?

because I want to add more ultrasonic sensors all around Magni and at different heights, avoiding obstacles on the sides and back. Because at the moment, when Magni reverse, it just hit things…,

Thanks

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [May 8, 2021, 5:40am UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/39 "2021-05-08T05:40:58Z")

</div>

We have no ability to add more than the 5 sonars on our current Sonar board.

What some people have thought about is to use the two sonars that point to the direct left and right and make extension cables then you could mount those near the back of the robot and that would do what you are asking at least in a way to offer some visibility to behind the robot. You would still have a total of 5 sonars.

I could envision how adding a lot more sonars is possible with a fairly involved system that monitors additional sonars and in some way such as through an added serial port off of a usb to serial converter could report sonar distances. That would be a hardware as well as software project of significant and complex software and hardware tasks.

We have no plans to have such a system anytime soon but we do have longer range plans to support that sort of thing in future robots.

We have experimented in the use of a newer sonar type that outputs compatible signals our software expects but uses sonars at the end of a long cable. This would allow having a total of 5 sonars still but you could place and point those sonars any way you want. They are limited to only seeing things 25cm or farther away but for collision that is sometimes enough. If you understand some hardware basics you could look into usage and try replacing the 2 sonars on the side sonars to use these units which are 4-pin compatible to our current boards but have long cables to route the 2 sonars near the back in your case. Search for: JSN-SR04T-2.0 units. Be careful unsoldering our sonars because the traces on the board can be easily damaged. Suggest you cut off the pins very close to the board then remove pins carefully by heating up on the PCB and carefully pulling out the pins then you can mount the new units. I would use a 4-pin inline female socket to mount the new ones and in fact I have done this in my own experiments.

---

<div class="post-metadata">

**Author:** ![inmoov](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/inmoov/32/473_2.png) [@inmoov](https://forum.ubiquityrobotics.com/u/inmoov)\
**Post date:** [May 8, 2021, 12:33pm UTC](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536/40 "2021-05-08T12:33:21Z")

</div>

@mjstn2011,

ok, I see…,

1. For the extension sonar units, is it this one below? (I found on ebay)  
[https://www.ebay.com.au/itm/191780137709?hash=item2ca6fcaaed:g:gvkAAOSw4ntcSmA6](https://www.ebay.com.au/itm/191780137709?hash=item2ca6fcaaed:g:gvkAAOSw4ntcSmA6)

Also, do I plug the USB to the Raspberri Pi and then solder the board to the Magni sonar board? is that how it operates?

 ![image](https://forum.ubiquityrobotics.com/uploads/default/original/1X/b1f3248d856295b29b226e4b7554ea8e6b1f14f6.jpeg)

1. for the " 4-pin inline female socket" , does that mean when I have unsoldered the left and right sonars, I will need to solder the “4-pin inline female socket” on the sonar board? but then cant I just solder this new sonar board above to the Magni Sonar board?

2. And I can only found these ones for the socket?

> **[Pardon our interruption...](https://www.ebay.com.au/splashui/challenge?ap=1&appName=orch&ru=https%3A%2F%2Fwww.ebay.com.au%2Fitm%2F233228345013%3Fhash%3Ditem364d7e1eb5%3Ag%3AX3sAAOSw9Ohc29a-&iid=6f6979a1-0b1e-468e-a59f-db2603d588c9&iim=PMTM4Lja&iia=HBY4LjE1fp&iiz=rSYNi4xMDM*bkp)**

are those right?

[Previous page](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536.md?page=1)

[Next page](https://forum.ubiquityrobotics.com/t/sonar-board-test-fails/536.md?page=3)
