Accurate satellite orientation is a prerequisite for a successful mission, therefore the Attitude Determination and Control System (ADCS) is one of the most important satellite systems. In this repo, the ADCS system software is presented, which enables the collection and processing of the orientation sensors data, attitude determination, actuator control and finally, control of the desired orientation.
Click on an image for a YouTube video.
IMPORTANT: Recommended OS for the development is the Ubuntu 21.10. If you don't have a machine with the Ubuntu 21.10, the easiest workaround is to install Ubuntu on a Virtual Machine (Link for a tutorial).
Make sure you install all required dependencies listed below with written versions (or higher). After you have all the requirements installed, then you can go to the building stage, and finally to the debugging stage.
- GNU Make (v4.3)
- git (v2.32.0)
- Ninja build system (v1.10.1)
- CMake (v3.18.4)
- GNU Arm Embedded Toolchain (v10.3-2021.10)
- ClangFormat (v13.0.0-2)
- OpenOCD (v0.11.0-rc2)
- Cppcheck (v2.3)
- Visual Studio Code (Link)
To install all the dependencies on the Ubuntu 21.10, user can just follow the steps below. Steps below will install all the required tools and VSCode code editor with all the required extensions.
- Clone project
- Position yourself in the project root directory with
cd cubesat-adcs
- Install all dependencies by running
make install_deps
(requires sudo privileges)
- Clone git submodules with
git submodule update --init --recursive
- Setup CMake with
make setup_cmake
(needed only once) - Build with
make build
or simplymake
- Open vscode in project root folder with
code .
- Go to
Run and Debug
and runCortex Debug
debug configuration
- run
make debug_gdb
- open gdb in another terminal
- connect to the running openocd target with
target remote localhost:5000
- run
make flash
and wait for completion
- run
make clang_format
- run
make cppcheck
- src/middlewares/optimal_request - Optimal request algorithm copied from https://github.com/IvanVnucec/Optimal-REQUEST
- src/middlewares/adcs - Files for Attitude determination and control system files
- src/drivers/user/mpu9250 - MPU9250 IMU drivers
STM32 Nucleo board for STM32L412 is configured by default to use internal clock. We had problems with the UART baudrate. When configured to 115200 bits/s we would have about 108000 bits/s. In order to configure Nucleo board to use external crystal (from the STM Link) we have unsoldered SB5 and SB7 solder bridges and soldered SB17 solder bridge. Doing that we have introduced a bug where initial pins PB7 and PB6 for UART did not work, they were in high state when transmitting. To fix the bug we have changed pinout to PA10 and PA9 for the UART1.
To use parser functionalities:
- Connect to the bluetooth module on the board with some terminal program. I tend to use the "Serial Bluetooth Terminal 1.36" on my Android phone to send and receive character commands.
- Add your callback function definitions and declarations in the
callbacks.hpp
andcallbacks.cpp
files and also add function pointers to them_callbacks
variable inparser.hpp
file. - Send commands as
echo(some text)\n
. Be aware that every parser command, in order to be received, must end with the EOL ('\n') character. - Observe incomming messages.