Skip to content

Latest commit

 

History

History
70 lines (57 loc) · 4.62 KB

README.md

File metadata and controls

70 lines (57 loc) · 4.62 KB

build-and-test

Cubesat-ADCS

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.

Video Demonstration

Click on an image for a YouTube video.
ADCS Demo

Development

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.

Dependencies

Install dependencies

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.

  1. Clone project
  2. Position yourself in the project root directory with cd cubesat-adcs
  3. Install all dependencies by running make install_deps (requires sudo privileges)

Building

  1. Clone git submodules with git submodule update --init --recursive
  2. Setup CMake with make setup_cmake (needed only once)
  3. Build with make build or simply make

Debugging

With vscode

  1. Open vscode in project root folder with code .
  2. Go to Run and Debug and run Cortex Debug debug configuration

With GDB

  1. run make debug_gdb
  2. open gdb in another terminal
  3. connect to the running openocd target with target remote localhost:5000

Flashing

  1. run make flash and wait for completion

Code formatting

  1. run make clang_format

Code analysis

  1. run make cppcheck

Code structure

  • 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

Problem with the UART Baudrate

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.

Usage

Parser

To use parser functionalities:

  1. 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.
  2. Add your callback function definitions and declarations in the callbacks.hpp and callbacks.cpp files and also add function pointers to the m_callbacks variable in parser.hpp file.
  3. 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.
  4. Observe incomming messages.