Autopilot

From 'Engineers of Innovation Wiki'
Jump to navigation Jump to search

Platform

Ease of development dictated the choice to run the control loop on existing hard- and software. which was chosen to be Ardupilot running on a orange cube.

Ardupilot PCB with the orange cube mounted.

To make use for our application a PCB has been designed to integrate into the hydrofoil design.


To connect to the ardupilot on the cube for tweaking settings and tuning control loops, Mission Planner will be used. The following section have tweaked settings found in Mission Planner.

Hardware

The cube is a plug-and-play unit and therefore does not need setup changes in the underlying ardupilot software. Only necessary settings should be tweaked.

Apart from the settings, tuning needs to be done in Mission Planner, this can only be done with the solar boat in the water and therefore no values are known for now.

The ardupilot PCB supports three servo motors, two front and one back motor. It has two isolated power supplies for the servo motors. Support for CAN and the cube is powered by the 24v input from the CAN connection.

It has its own GPS antenna and four UART serial ports, where Serial1 is used for the MAVLINK connect to Mission Planner that is running on a laptop. Two of these serial ports will be used to implement the height sensors that will be mounted on the boat for measuring the height of the water. This ensures that the system correctly responds to waves where the boat can 'surf' over.

For steering on foils an extra MCU is added onto the board namely: ATSAMD20E18A. This MCU can receive data from the rudder that gives the steering position and sends it through to the cube.

Height Sensors

Currently testing ultrasonic height sensors, the RS485 version of the DYP-A02YY4W-V2.0.

Ardupilot settings

To use the ardupilot as the foil control unit, some settings need to be changed since they do not apply to us or should be disabled. These settings are given below with a small explanation why it has been configured as is.

The settings below are the changed settings used by the ardupilot. There are more ports available on the ardupilot, whenever more are used or are changed the table will be updated.

Configuration of ardupilot
Setting Value Description Reason
INS_GYR_CAL 0 Controls the automatic gyro calibration. Gyro calibration requires that the unit should be held as still as possible.
SERVO1_FUNCTION 78 ElevonRight Controls the right foil assembly.
SERVO2_FUNCTION 77 ElevonLeft Controls the left foil assembly.
INITIAL_MODE 5 FBWA Fly By Wire A this is a fly mode for the control unit. More can be found here.
GPS_TYPE2 5 NMEA This sets the GPS data that is sent onto the serial data port.
SERIAL1_PROTOCOL 2 MAVLINK2 Controls what protocol to use on the serial port
SERIAL1_BAUD 57 57600 Specifies the baudrate of the serial port.
SERIAL4_PROTOCOL 5 GPS Controls what protocol to use on the serial port
SERIAL4_BAUD 9 9600 Specifies the baudrate of the serial port.

Future plans

As of now: 21-03-2023, FBWA mode is used for controlling the front two foil assembly. It would probably be beneficial whenever the whole system is finished to move towards the FBWB mode.

This mode supports "Automatic Altitude Holding", that makes sure that the same level of altitude is automatically kept. Further testing is needed for determining the control loops and their coefficients.

Implementing the different sensors into ardupilot and using that data to respond to the environment. These sensors are at least the height sensors and the rudder sensor for the steering angle.

Relevant links for configuring Ardupilot

https://ardupilot.org/copter/docs/common-gcs-only-operation.html

https://ardupilot.org/copter/docs/common-rangefinder-landingpage.html

https://ardupilot.org/copter/docs/setting-up-for-tuning.html

https://ardupilot.org/copter/docs/terrain-following-manual-modes.html

https://ardupilot.org/copter/docs/common-sensor-offset-compensation.html

https://ardupilot.org/copter/docs/crash_check.html

https://ardupilot.org/copter/docs/flight-modes.html --FBW-A mode seems best fit for front only, FBW-B for finalized system

https://ardupilot.org/plane/docs/fbwb-mode.html

https://ardupilot.org/copter/docs/stabilize-mode.html

https://ardupilot.org/plane/docs/fixed-wing-faq.html --Disable Gyro calibration on start-up

https://ardupilot.org/rover/docs/sonar-sensors.html --Two sonar sensors

https://ardupilot.org/dev/docs/plane-architecture.html --Plane architecture and files