Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ba79399
debugging oot controller
moisesmata Feb 17, 2025
03f6fe1
Merge branch 'testing-oot' of https://github.com/A2R-Lab/tinympc-craz…
paeb37 Feb 17, 2025
b1dfe4e
resetproblem issue fixed
paeb37 Feb 18, 2025
e5ae551
more changes on debugging oot
paeb37 Feb 19, 2025
106dc8d
stuck on Q and R matrices setup
paeb37 Feb 19, 2025
64d1602
still stuck on Q and R
paeb37 Feb 19, 2025
36b68a2
Update Submodule
moisesmata Aug 21, 2025
39d89d8
TinyMPC submodule tracks main TinyMPC
moisesmata Aug 21, 2025
0809b39
More understandable file restructure
moisesmata Aug 21, 2025
7174d7c
Add app_api files
moisesmata Aug 21, 2025
005f04e
OOT that refers to PID
moisesmata Aug 21, 2025
8ee4a90
Add TinyMPC submodule properly
moisesmata Aug 21, 2025
b3445d1
Move TinyMPC submodule to apps/tinympc/TinyMPC
moisesmata Aug 21, 2025
3b5a1c2
Clean up TinyMPC submodules and add fresh one at apps/tinympc/TinyMPC
moisesmata Aug 21, 2025
663072e
Update TinyMPC submodule to point to moisesmata/tinympc debug-guards …
moisesmata Aug 21, 2025
a8839a9
New TinyMPC Controller, Compiles, Not Tested
moisesmata Aug 21, 2025
511193a
Uncommented Eigen, Controller Base Implemented
moisesmata Aug 21, 2025
65f9913
Actual TinyMPC Controller, Not Tested Yet
moisesmata Aug 21, 2025
ad235bb
Stripped Down Version That Works
moisesmata Aug 29, 2025
e6027da
Matrix Tests that work on stm
moisesmata Aug 29, 2025
d4ac6ed
Eigen test App
moisesmata Sep 3, 2025
56914b6
Start fresh, keep only eigen test
moisesmata Sep 3, 2025
7d285e6
submodule in root level
moisesmata Sep 4, 2025
9f4563c
new folder location for controller
moisesmata Sep 4, 2025
bf94536
boot loop version
moisesmata Sep 4, 2025
f9c5de4
builds, stepping towards full functionality
moisesmata Sep 10, 2025
4b312bd
New tinympc basic controller, using new firmware, old tinympc
moisesmata Sep 10, 2025
d53c3be
Builds and flies! but crashes
moisesmata Sep 10, 2025
7d4668e
Hover works! Old TinyMPC, new firmware
moisesmata Sep 11, 2025
1072298
Fixed Bracket
moisesmata Sep 11, 2025
c617042
Working! Does the line and comes back to origin
moisesmata Sep 11, 2025
528f971
Working with ADMM workspace
moisesmata Sep 11, 2025
edf8ec9
More efficient with RAM
moisesmata Sep 11, 2025
784fe20
Readme.md
moisesmata Sep 11, 2025
bdaa25c
Update TinyMPC submodule to debug-guards branch
moisesmata Sep 11, 2025
43b0e36
Initial eigen (direct control) implementation
moisesmata Sep 12, 2025
741a501
Changed control mode
moisesmata Sep 12, 2025
6dea4fc
Possibly working figure 8 -- need to test still
moisesmata Sep 12, 2025
9a0c5f6
Most up to date cpp
moisesmata Sep 12, 2025
1b52fbb
Updated Submodule
moisesmata Oct 7, 2025
96be12e
TinyMPC Eigen working, old TinyMPC, new firmware
moisesmata Oct 7, 2025
e84f7d4
update submodule
moisesmata Oct 11, 2025
7a35407
Remove unneeded apps, submodule update
moisesmata Oct 11, 2025
ccc0f56
satraIGHT
Jan 22, 2026
f9022fb
WIP: obstacle avoidance - eigen half-space experiments, eigen_task st…
Jan 22, 2026
59e33b5
linear tv working
Jan 23, 2026
7946eb8
nice swerve
Jan 23, 2026
be8f8bd
sdp on tv off
Jan 23, 2026
12aed78
demo
Jan 23, 2026
4c9f859
certificate
Jan 23, 2026
22fcf3f
Fix controller_tinympc_eigen for new firmware
ishaanamahajan Feb 6, 2026
d3d80ce
figure-8 working
ishaanamahajan Feb 6, 2026
3d23506
end to end tinympc
ishaanamahajan Feb 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
*.cmd
*.tmp
*.o
*:Zone.Identifier
11 changes: 7 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "apps/eigen_test/Eigen"]
path = apps/eigen_test/Eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "TinyMPC"]
path = TinyMPC
url = https://github.com/moisesmata/TinyMPC
[submodule "crazyflie-firmware"]
path = crazyflie-firmware
url = https://github.com/bitcraze/crazyflie-firmware.git
[submodule "TinyMPC"]
path = src/TinyMPC
url = https://github.com/moisesmata/TinyMPC.git
url = https://github.com/moisesmata/crazyflie-firmware.git
1 change: 0 additions & 1 deletion Kbuild

This file was deleted.

25 changes: 0 additions & 25 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions TinyMPC
Submodule TinyMPC added at c19139
3 changes: 3 additions & 0 deletions apps/controller_tinympc_eigen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin/*
cf2.*
build/*
1 change: 1 addition & 0 deletions apps/controller_tinympc_eigen/Kbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-y += src/
38 changes: 38 additions & 0 deletions apps/controller_tinympc_eigen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# The firmware uses the Kbuild build system. There are 'Kbuild' files in this
# example that outlays what needs to be built. (check src/Kbuild).
#
# The firmware is configured using options in Kconfig files, the
# values of these end up in the .config file in the firmware directory.
#
# By setting the OOT_CONFIG (it is '$(PWD)/oot-config' by default) environment
# variable you can provide a custom configuration. It is important that you
# enable the app-layer. See app-config in this directory for example.

#
# We want to execute the main Makefile for the firmware project,
# it will handle the build for us.
#
CRAZYFLIE_BASE := ../../crazyflie-firmware

#
# To include header files from other directories
#
# EXTRA_CFLAGS += -lstdc++
# EXTRA_CFLAGS += -lgcc
# EXTRA_CFLAGS += -lc
# EXTRA_CFLAGS += -lm
EXTRA_CFLAGS += -I$(PWD)/TinyMPC-ADMM/ext/Eigen
EXTRA_CFLAGS += -I$(PWD)/TinyMPC-ADMM/src
EXTRA_CFLAGS += -DEIGEN_INITIALIZE_MATRICES_BY_ZERO
EXTRA_CFLAGS += -DEIGEN_NO_MALLOC
EXTRA_CFLAGS += -DNDEBUG
EXTRA_CFLAGS += -Wno-unused-result
#
# We override the default OOT_CONFIG here, we could also name our config
# to oot-config and that would be the default.
#
OOT_CONFIG := $(PWD)/app-config

OOT_USES_CXX := 1

include $(CRAZYFLIE_BASE)/tools/make/oot.mk
44 changes: 44 additions & 0 deletions apps/controller_tinympc_eigen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# TinyMPC-ADMM Controller for Crazyflie

This is a TinyMPC-ADMM based controller for the Crazyflie, adapted for the latest firmware API. It's based on the original implementation by Ishaan's team but updated to work with the new crazyflie firmware structure.

## Features

- Uses TinyMPC-ADMM for Model Predictive Control
- Supports trajectory tracking and setpoint following
- Eigen-based matrix operations for efficient computation
- Configurable solver parameters and trajectory options

## Key Changes from Original Implementation

1. Updated controller function signature to use `stabilizerStep_t` instead of `uint32_t tick`
2. Adapted for new firmware build system and structure
3. Maintained compatibility with TinyMPC-ADMM library
4. Added proper includes for new firmware API (`stabilizer_types.h`)

## Build Instructions

1. Navigate to this directory
2. Run `make` to build the controller
3. Flash the resulting firmware to your Crazyflie

## Configuration

- Trajectory parameters and model matrices are defined in header files (e.g., `params_500hz.h`, `traj_fig8_12.h`)
- Controller parameters can be adjusted in the main controller file
- MPC solver settings (iterations, tolerances) are configurable

## Logging

The controller provides several logging variables for monitoring:
- `ctrlMPC.iters`: Number of solver iterations
- `ctrlMPC.mpcTime`: Solver execution time in microseconds
- `ctrlMPC.primal_residual`: Primal residual from ADMM solver
- `ctrlMPC.dual_residual`: Dual residual from ADMM solver
- `ctrlMPC.ref_x/y/z`: Reference trajectory coordinates

## Notes

- The controller runs at 500Hz by default
- Trajectory execution can be enabled/disabled via `en_traj` parameter
- Hover values are preconfigured for specific Crazyflie units and may need adjustment
21 changes: 21 additions & 0 deletions apps/controller_tinympc_eigen/TinyMPC-ADMM/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Robotic Exploration Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions apps/controller_tinympc_eigen/TinyMPC-ADMM/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TinyMPC-ADMM
82 changes: 82 additions & 0 deletions apps/controller_tinympc_eigen/TinyMPC-ADMM/ext/Eigen/Eigen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
Eigen.h
Brian R Taylor
brian.taylor@bolderflight.com
2017-02-08

Copyright (c) 2017 Bolder Flight Systems

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

// Credits: @rpavlik for writing the original header for the Eigen313 library, which this
// was derived from:
// http://forum.arduino.cc/index.php?PHPSESSID=a86gv50nb3e3ireijfmli63260&topic=144446.msg1089371#msg1089371

// Disable debug asserts.
#define EIGEN_NO_DEBUG 1

// Hint to number of registers
#define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 16

#ifdef A0
# define NEED_A0_RESTORED A0
# undef A0
#endif
#ifdef A1
# define NEED_A1_RESTORED A1
# undef A1
#endif
#ifdef B0
# define NEED_B0_RESTORED B0
# undef B0
#endif
#ifdef B1
# define NEED_B1_RESTORED B1
# undef B1
#endif
#ifdef round
# define NEED_round_RESTORED round
# undef round
#endif

namespace std {
struct nothrow_t;
}

// Include main EIGEN Core header
#include <Eigen/Core>

#ifdef NEED_A0_RESTORED
# define A0 NEED_A0_RESTORED
# undef NEED_A0_RESTORED
#endif
#ifdef NEED_A1_RESTORED
# define A1 NEED_A1_RESTORED
# undef NEED_A1_RESTORED
#endif
#ifdef NEED_B0_RESTORED
# define B0 NEED_B0_RESTORED
# undef NEED_B0_RESTORED
#endif
#ifdef NEED_B1_RESTORED
# define B1 NEED_B1_RESTORED
# undef NEED_B1_RESTORED
#endif
#ifdef NEED_round_RESTORED
# define round NEED_round_RESTORED
# undef NEED_round_RESTORED
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include(RegexUtils)
test_escape_string_as_regex()

file(GLOB Eigen_directory_files "*")

escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

foreach(f ${Eigen_directory_files})
if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src")
list(APPEND Eigen_directory_files_to_install ${f})
endif()
endforeach(f ${Eigen_directory_files})

install(FILES
${Eigen_directory_files_to_install}
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel
)

install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h")
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_CHOLESKY_MODULE_H
#define EIGEN_CHOLESKY_MODULE_H

#include "Core"
#include "Jacobi"

#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup Cholesky_Module Cholesky module
*
*
*
* This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
* Those decompositions are also accessible via the following methods:
* - MatrixBase::llt()
* - MatrixBase::ldlt()
* - SelfAdjointView::llt()
* - SelfAdjointView::ldlt()
*
* \code
* #include <Eigen/Cholesky>
* \endcode
*/

#include "src/Cholesky/LLT.h"
#include "src/Cholesky/LDLT.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Cholesky/LLT_LAPACKE.h"
#endif

#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_CHOLESKY_MODULE_H
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
#define EIGEN_CHOLMODSUPPORT_MODULE_H

#include "SparseCore"

#include "src/Core/util/DisableStupidWarnings.h"

extern "C" {
#include <cholmod.h>
}

/** \ingroup Support_modules
* \defgroup CholmodSupport_Module CholmodSupport module
*
* This module provides an interface to the Cholmod library which is part of the <a href="http://www.suitesparse.com">suitesparse</a> package.
* It provides the two following main factorization classes:
* - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
* - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
*
* For the sake of completeness, this module also propose the two following classes:
* - class CholmodSimplicialLLT
* - class CholmodSimplicialLDLT
* Note that these classes does not bring any particular advantage compared to the built-in
* SimplicialLLT and SimplicialLDLT factorization classes.
*
* \code
* #include <Eigen/CholmodSupport>
* \endcode
*
* In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies.
* The dependencies depend on how cholmod has been compiled.
* For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
*
*/

#include "src/CholmodSupport/CholmodSupport.h"

#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_CHOLMODSUPPORT_MODULE_H

Loading