Home        Store        Docs        Blog

Upload Ardusub code to pixhawk using waf


(Alexis Gaziello) #1

Hello,
I have recently started working with a BlueRov2 and I the reason I am writing this post is to get help uploading code to the pixhawk.
After downloading the ardupilot repository, I made some modifications (just some simple methods on the joystick.cpp custom cases) and now I am trying to follow the instructions to upload the code using waf. However I have some difficulties.

I first used the following line to configure the board (I think that is the px4-v2 model) and everything went well.

./waf configure --board px4-v2
->‘configure’ finished successfully (0.592s)

Now I think I should use this one to upload it to the pixhawk:
./waf configure --board --rsync-dest
In my case:
./waf configure --board px4-v2 --rsync-dest pi@192.168.2.2…???

How should I continue?

I hope my problem was correctly explained.

Finally, I would also like to know why the library is switching to using waf instead of the classic cmakelists, a common known standart tool to build code.

Thank you for your time,
Alexis


(Patrick José Pereira) #2

Hi Alexis,

To build ardusub, you will need to configure waf to create a pixhawk v2 binary.

  • ./waf configure --board px4-v2

After that, it will be necessary to build ardusub and not others vehicles.

  • ./waf build sub --verbose

Now, to upload ardusub, you’ll need to connect the pixhawk in your computer and do the upload.

  • ./waf --upload sub

It’s not possible to update ardusub via rsync, this argument is used for Linux boards, in BlueROV2 the raspberry is used only as a companion computer and not to control the ROV itself.

This is for historical reasons in ArduPilot project, but before waf the build system was Makefiles and not CMakeLists.


(Jacob) #3

You will not be able to upload to the autopilot connected to a remote host with the build tools in the ardupilot repository alone.

You will need to transfer the file to the remote host, and then run the px_uploader.py script located in the tools directory of the arudpilot repository (transfer the script to the remote host, too).

If you are using a BlueROV2, or a Raspberry Pi with our companion computer image, then an easier way might be to use the UI at http://192.168.2.2:2770/system.


(Alexis Gaziello) #4

Thank you for your replies.
Patrick José I am no sure I did understand the line “./waf --upload sub”. Should I run this from inside the pixhawk? How can the command know where to upload the “sub”?

On the other hand, It may be easier to follow Jacob instructions. I should be able to send the binaries/files created by waf via scp to the raspberry pi (we are using your companion computer image) and then use the script px_uploader.py to upload it to the pixhawk. I will try to understand it’s usage.
I will also take a look at the UI you mention. I did not know that utility. Why 2770? Is it a random number defined by BlueRobotics?

Sorry for this questions which may be basic for you but I am still a student and I have difficulties finding documentation.


(Patrick José Pereira) #5

Hi Alexis,

Sorry for not putting this in a clear way.

All commands of my previous post should be done in the root folder of your ArduPilot source code, it’s the local of waf script. The pixhawk should be connected in your computer usb.

To do what Jacob said, related to http://192.168.2.2:2770/system webpage, you will need:

  • Build ArduSub with ./waf build sub
  • Go to the /system webpage.
  • Select Choose File, the .px4 file will be in build/px4-v2/bin inside ArduPilot root folder.
  • Click in Upload.
    After that, you will see the flash process happening.
Attempting upload from file /tmp/data/ardusub.px4
Stopping mavproxy
Flashing Pixhawk...
Loaded firmware for 9,0, size: 909212 bytes, waiting for the bootloader...
attempting reboot on /dev/ttyACM0...
Found board 9,0 bootloader rev 4 on /dev/ttyACM0
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
Erase  : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.

Waiting to restart mavproxy...
Restarting mavproxy
Complete!

(Jacob) #6

Yes.


(Alexis Gaziello) #7

Hello Jacob and Patrick,
Sorry for the late reply. Everything now is clear and working. Thank you for your assistance.
Alexis


#8

Which directory should I be in to do this terminal flashing?

The usual ardupilot folder is not doing the job for me.
Let me check the GUI Flashing method.

Thanks for the info anyway.