onboardsdk
Loading...
Searching...
No Matches
Blueye SDK

The Blueye SDK provides a set of libraries and tools for controlling and interacting with Blueye drones. It enables developers to communicate with the drone, access sensor data, and control various aspects of its behavior.

Getting Started

To start using the Blueye SDK, follow these steps:

  1. Connect to your drone Wi-Fi
  2. Deactivate the Blueye control system (persistent)

    ssh sdk@192.168.1.101 touch entrypoint
    ssh sdk@192.168.1.101 chmod +x entrypoint
    ssh sdk@192.168.1.101 be-reboot
  1. Create a folder for your code and add user_program.cpp

    #include <iostream>
    #include "drone/PioneerDrone.hpp"
    int main() {
    std::cout << drone.get_imu() << std::endl;
    }
    imu::ImuData get_imu() const
    Get the calibrated IMU data.
    Class representing a drone.
    Definition PioneerDrone.hpp:31
  2. Write a CMakeLists.txt file.

    cmake_minimum_required(VERSION 3.18)
    project(user_program VERSION 1.0.0)
    set(CMAKE_CXX_STANDARD 20)
    find_package(blunux REQUIRED)
    include_directories(${blunux_INCLUDE_DIRS})
    link_directories(${blunux_LIB_DIRS})
    add_executable(user_program user_program.cpp)
    target_link_libraries(user_program ${blunux_LIBRARIES})
    install(TARGETS user_program DESTINATION bin)
  3. Compile the program
    • Start the docker container (You might change back to your Wi-Fi with internet for this):

      docker run -it --name blunux-sdk --rm -v $(pwd):/root/workspace ghcr.io/blueye-robotics/blunux-onboard-sdk:blunux-3.3
    • In the container, run:

      source /opt/poky/3.4.4/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
      cd /root/workspace
      mkdir build
      cd build
      cmake ..
      make -j $(nproc)
      exit
  4. Copy the program to the drone

    scp -O build/user_program sdk@192.168.1.101:
  5. Run the program on the drone

    ssh sdk@192.168.1.101 ./user_program

    You will see the output of your code, but also output from the library. The output from the library is prefixed with blunux: and can be deactivated in the user program, see for example be-drone-imu.cpp.

Examples

The Blueye SDK comes with several examples to help you get started quickly. Here are some example applications:

Refer to these examples for practical usage scenarios and integration into your own projects.

API Reference

The Blueye SDK provides a comprehensive API for interacting with the drone. For detailed information about the available classes, methods, and data structures, follow the links on the top of the page.

Run the program on your drone

Copy files to drone

Copy the files to the drone:

scp -O <program-name> sdk@192.168.1.101:

The -O is for compatibility and not needed on all systems.

Prevent the start of the blueye control system

Create an empty file with the name entrypoint, make it executable, and copy it to the drone.

touch entrypoint
chmod a+x entrypoint
scp entrypoint sdk@192.168.1.101:

Reboot the drone by running:

ssh sdk@192.168.1.101 be-reboot

When the drone comes up again, the blueye control system should not be running.

Now, you can login to your drone and start your program manually:

ssh sdk@192.168.1.101
./<program-name>

If you always want to start your program automatically, you can add it to the entrypoint file.

For example:

# This is an example entrypoint file that runs "my_program"
/data/sdk/my_program

Warnings

  • Do not run the lights on more than 10% intensity when not in water!
  • Avoid running thrusters when not in water!
  • When controlling the thrusters make sure to use some ramping, otherwise the power consumption might be too high and the battery might shut off.
  • Before updating the drone, deactivate your entrypoint and restart the drone.

Notes

ssh access

You can login to the drone as follows:

ssh sdk@192.168.1.101

Entrypoint

Unless there is a /data/sdk/entrypoint, the Blueye control system is launched when the drone starts. When you create an own entrypoint, make sure it's executable.

If present and executable, the /data/sdk/entrypoint script will be run instead of the Blueye control system.

Extra Entrypoint

Sometimes, you might want to run your own programs, but still use the Blueye control system. In this case, you can create an executable file /data/sdk/entrypoint_extra. This will be run also when /data/sdk/entrypoint does not exist and the Blueye control system is stated.

Please note the following:

  • You cannot use the same hardware the Blueye control system is using, especially thrusters, lights, sensors.

User data on the SD card

If your program needs to store large amounts of data, you should save it on the SD card instead of the internal memory. The folder you can use is /videos/sdk.

Remove your data

To remove your custom data, login to the drone and delete all the files in /data/sdk and /videos/sdk. The drone should then start as usual.

scp connection closed

On some systems, you might get the following error when trying to copy data to the drone:

~ scp <file> sdk@192.168.1.101:
subsystem request failed on channel 0
scp: Connection closed

If this happens, try to use scp -O instead:

scp -O <file> sdk@192.168.1.101: