APM with Bebop 2 sonar

Hi, all
I have a Bebop2 running on arducopter. and I want to fly Bebop2 indoors,
I think maybe there are two ways
1.to install LIDAR on Bebop2 uart port
2.porting Bebop2 sonar firmware
But I am not able to find any working resources for bebop2 sonar.
Any help would be appreciated. thank you

I guess you want to fly indoors in LOITER mode?
If you fly with modes that don’t require GPS you don’t need anything.
If you want to use LOITER or other modes that require a GPS but indoors, you need optical flow and so you also need sonar.
The Bebop sonar is already supported in ardupilot though it may require some tricks to make it work.
For the optical flow. I have implemented a basic version but I never spent enough time, and also never had a really good knowledge of how the EKF handles the optical flow so I haven’t been able to debug it and make it usable in practice to fly indoors.

1 Like

Hi julienberaud,

How to set up Bebop sonar to make it work??
I use UWB fly indoors in LOITER mode.
But the height is not very accurate, I want to change to sonar.

Thank you for your reply.

I don’t guarantee you that the sonar is very accurate, but mainly you need to build libiio for bebop (using armhf) and install it on the target. I’ll see if I can do this tomorrow.

1 Like

Hi julienberaud,
can you tell me how to build libiio for bebop (using armhf)?
I appreciate you taking your time.


So, in order to do that, you need to follow the instructions here but replace the following command
$ ./build.sh all final -j5
$ ./build.sh config-update
$ ./build.sh libiio
the build output will indicate you that the library is located under
Then I just tested and there are compilation issues in ardupilot. I am trying to take a look at these right now.

1 Like

Hi~ julienberaud,

Before I refer to the instructions to running bebop-2

I refer to your suggestion,build libiio.so is success~
but I am not sure where to put libiio.so.
/data/ftp/internal_000/ardupilot/ ???

I try to put libiio.so -> /data/ftp/internal_000/ardupilot/
and set mission planner rngfnd_type : 9 Bebop
But can’t read the value of sonar …

Hi. You have to build arducopter with the HAVE_LIBIIO flag activated and for that, I haven’t found a proper way yet.

Hi~ julienberaud,
i put libiio.a -> ~/bebop2_ardupilot/ardupilot/modules/waf/waflib/
i define HAVE_LIBIIO 1 in RangeFinder.h file. and try to build arducopter,
Build failed

I refer to other articles~
maybe link statically to ardupilot and should work
but i’m not sure how to libiio.a link statically

Now that static build is fixed on master, I have found a workaround.

get the following branch https://github.com/jberaud/ardupilot/tree/dev/libiio-linking

Then install libiio:armhf
sudo apt install libiio-dev:armhf
and copy libiio.a in /usr/lib/arm-linux-gnueabihf
cp libiio.a /usr/lib/arm-linux-gnueabihf/

Then build statically:
./waf configure --board=bebop --static
./waf build --target=bin/arducopter
This will enable the bebop’s rangefinder at compile time.
Then on the board, set the rangefinder param to 9 and restart ardupilot.


Hi Julien~
I use PC Ubuntu 16.04 install libiio-dev OK,
cp libiio.a /usr/arm-linux-gnueabihf/lib/ (Different from your folder)
Then build statically and set param OK, but sonar isn’t to work.

i guess is libiio-dev:armhf problem
i try to install libiio:armhf have many dependencies issues…
did you install on the ARM machine?


Please refer to my instructions,

install libiio-dev:armhf
What are the dependency issues you see ?
If you don’t install armhf but the native version, it won’t work.
I installed libiio-dev:armhf on my host machine (intel).


Hi Julien~

I use Raspberry pi3 to install armhf and build is OK,
sonar is to work~~~~

Thank you for your kind assistance. :slight_smile:

Funny that using a raspberry pi3 helped you but as long as you have managed to make it work that’s great :slight_smile:

Yes, Sonar performance is good~
thank you for your help.

1 Like

I’m trying to install arducopter onto my bebop2 but I keep getting a adb.exe not found. Any help would be greatly appreciated!