![]() |
Artemis Teensy Flight Software
The software on the Teensy in the Artemis cubesat.
|
This is a guide on how to set up your Development Environment (DE) to compile, run, and debug the Teensy Flight Software (FSW).
The FSW is written and compiled using Visual Studio Code (VSCode). Download and install this editor.
Once installed, click the Extensions tab on the left navigation menu.
Search for the C/C++ extension and install it if not already installed.
The PlatformIO IDE is used for programming the Teensy. It is installed as an extension to VSCode. Search for the PlatformIO IDE extension and install it.
You should then see the shell install the IDE. If you do not see this, restart VSCode.
After installation is complete, RESTART VSCode. Pressing "Reload Now" is not sufficient.
Verify PlatformIO IDE is installed. You should see a new icon in the left navigation menu.
You can now verify that the PlatformIO IDE has been installed correctly by creating a test project. Begin by pressing the home button on the bottom navigation bar.
Click on "New Project". If this page does not appear, restart VSCode. If the page still doesn't appear, retry the installation process.
Fill out the Project Wizard as shown and click Finish. Wait for the IDE to create the project.
If VSCode prompts you to trust the authors, click Yes.
You should now see the project open in your workspace.
The main code is located in src/main.cpp
. Add the following code to this file:
Before building the project, ensure the environment is set to Teensy 4.1. If the environment (as shown in the bottom navigation bar) says "Default", change it.
Click on Default (agent_artemis).
On the top of VSCode, a dropdown should have appeared. Click on env:teensy41
Verify your environment has changed.
Click the checkmark on the bottom navigation bar to build.
Connect a Teensy 4.1 to your computer over USB. Click the right arrow icon on the bottom navigation bar to upload the project to your Teensy.
After a successful upload, you can monitor the Serial output by clicking the plug icon on the bottom navigation bar.
Now that you've uploaded a test program, you are ready to work with the FSW. The easiest way to do so is with GitHub Desktop.
Install it and log in using your GitHub credentials. Go to the FSW repo. If you do not have access to this repo, verify that you have been added to the VIP Aerospace Technologies organization. If you are not, ask team leadership to be added to the organization.
Once you have access to the repo, press the green "Code" button, then press the "Open with GitHub Desktop" button.
GitHub Desktop will open with the Clone a repository dialog. You can choose where you want to save the repository here. It is usually a good idea to save the repo close to your root directory. Choose a local path and press "Clone".
Open the repo's directory in the Command Prompt/Terminal, and enter the following:
This initializes the micro-cosmos submodule, which the FSW relies on.
This ensures you have the most recent version of the submodule.
With the FSW repo cloned to your local machine, you are now ready to use it. Press the "Open in Visual Studio Code" in GitHub Desktop to open the FSW.
Alternatively, you can open VSCode, Press File then Open Folder... Navigate to the directory where you have the repo cloned (named Artemis-Teensy-Flight-Software). Select it, and press "Select Folder".
VSCode will now load the FSW. PlatformIO will also load.
To build and upload the code to the Teensy, you can use the individual buttons as described earlier in this guide. Alternatively, press the PlatformIO tab on the left navigation menu. The PlatformIO palette will open on the right, with your current environment selected.
Under teensy41 > General, you have multiple options. To build, upload, and monitor the FSW all at once, press the "Upload and Monitor" option.
The FSW will be compiled, uploaded, and sent to the Teensy. A Serial Monitor will be started in the Terminal window at the bottom.
In VSCode, enter the settings menu by clicking File > Preferences > Settings.
From there, type "format" in the search bar, and enable the option labelled "Format on save". This automatically applies uniform C++ formatting to the code you write whenever you save the file.
<img src="https://raw.githubusercontent.com/hsfl/artemis-cosmos-teensy-fsw/main/documentation/step21.png" alt="The "Format on Save" option in VSCode's settings menu."/>
Next, type "ruler" in the search bar, and press the "Edit in settings.json" option under Editor: Rulers. This opens up the settings.json file, and creates an entry called "editor.rulers". Within this entry, type in "80," like so:
Save the file, and you should now see a white vertical line at the 80th column of your editor. This marks an absolute width for your file, upon which the editor will try to automatically create a new line.