Using 2 sonar sensors on PX4 Board

543 views
Skip to first unread message

Anh Hoang Cong

unread,
Feb 21, 2016, 9:54:14 PM2/21/16
to drones-discuss
Hi
This is Anh from Korea
Currently, I am working on a Drone project which use 2 sonar sensors for applying obstacle avoidance on Drone  
My idea is connect these sensors to PX4 via i2c port on Px4, I have setup the 2 new addresses (0x70 and 0x6F ) for 2 Maxbotic sonar sensors
 
I ran the example in AP_RangerFinder/examples/RFIND_test, but i only received distance data from 1 sensor (please see the attached file). 
I think this problem happens because there is only 1 default address (0x70) is fixed in /PX4Firmware/src/drivers/mb12xx : #define MB12XX_BASEADDR 0x70 
(I tried to change to 0x6F and it only worked on the 0x6F sensor,ad ignored 0x70 sensor)

Is there anyone who know about this problem, could you please give me some advice?

Thank you for you time.
Regard,
Anh
Capture.JPG

Randy Mackay

unread,
Feb 22, 2016, 8:18:32 AM2/22/16
to drones-...@googlegroups.com
Any,
It looks like the example sketch is only setting the parameter values for the first sonar. I think maybe if you duplicate those three parameter related lines but add a "2" to the param name it might work?
https://github.com/diydrones/ardupilot/blob/master/libraries/AP_RangeFinder/examples/RFIND_test/RFIND_test.cpp#L19
I'd check the RangeFinder.CPP to be sure to get the param name correct.
https://github.com/diydrones/ardupilot/blob/master/libraries/AP_RangeFinder/RangeFinder.cpp#L129

--Randy

--------------------------------------------
On Mon, 2/22/16, Anh Hoang Cong <anh....@gmail.com> wrote:

Subject: [drones-discuss] Using 2 sonar sensors on PX4 Board
To: "drones-discuss" <drones-...@googlegroups.com>
Date: Monday, February 22, 2016, 11:52 AM

Hi
This is Anh from Korea
Currently, I am working on a Drone project which use 2 sonar
sensors for
applying obstacle avoidance on Drone 
My idea is connect these sensors to PX4 via i2c port on Px4,
I have setup
the 2 new addresses (0x70 and 0x6F ) for 2 Maxbotic sonar
sensors

I ran the example in *AP_RangerFinder/examples/RFIND_test*,
but i only
received distance data from* 1 sensor* (please see the
attached file).
I think this problem happens because there is only *1
default address*
(0x70) is fixed in* /PX4Firmware/src/drivers/mb12xx* :
#define
MB12XX_BASEADDR 0x70
(I tried to change to 0x6F and it only worked on the 0x6F
sensor,ad ignored
0x70 sensor)

Is there anyone who know about this problem, could you
please give me some
advice?

Thank you for you time.
Regard,
Anh

--
You received this message because you are subscribed to the
Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Al B

unread,
Feb 22, 2016, 12:06:07 PM2/22/16
to drones-discuss, rmac...@yahoo.com
Randy,

Will this also apply to the TeraRanger One?  The current TRONE_BASEADDR is 0x30, but I'd like to install a second one with address 0x62.

Anh Hoang Cong

unread,
Feb 25, 2016, 9:51:35 AM2/25/16
to drones-discuss
Dear Randy,

Thank you for your response


I did like you said, but the problem still happens
I think maybe the reason is the different addresses ,should I need to implement the mb12xx to use more than 1 sonar?  
Do you have any idea for me to use multiple sonar sensors on 1 PX4 like the photo below or I have to use other module and communicate with Px4 ?



Thank you very much for your support
Anh

Tom Pittenger

unread,
Feb 25, 2016, 10:01:49 AM2/25/16
to drones-discuss
have you tried using the param RNGFNDx_ADDR?

--

Anh Hoang Cong

unread,
Feb 25, 2016, 10:29:41 PM2/25/16
to drones-discuss
Hi Tom,
Could you explain for more detail?

I could not find this param in ardupilot source code which supports changing address for Maxbotix I2C Sensors on PX4 in my case

Only this param use for LightWave I2C sensor:
"
#if RANGEFINDER_MAX_INSTANCES > 1
    // @Param: 2_ADDR
    // @DisplayName: Bus address of 2nd rangefinder
    // @Description: This sets the bus address of the sensor, where applicable. Used for the LightWare I2C sensor to allow for multiple sensors on different addresses. A value of 0 disables the sensor.
    // @Range: 0 127
    // @Increment: 1
    // @User: Advanced
    AP_GROUPINFO("2_ADDR", 24, RangeFinder, _address[1], 0),
#endif
"

Thanks,
Anh
On Monday, February 22, 2016 at 11:54:14 AM UTC+9, Anh Hoang Cong wrote:

Tom Pittenger

unread,
Feb 26, 2016, 12:10:07 AM2/26/16
to drones-discuss

That's the one. I didn't realize it wasn't generic

--
Reply all
Reply to author
Forward
0 new messages