Skip to content

Instantly share code, notes, and snippets.

View leocelente's full-sized avatar

Leonardo Celente leocelente

View GitHub Profile
@leocelente
leocelente / motor-config.xml
Created April 22, 2023 23:07
VESC Motor configuration for the 410_LACEP board
<?xml version="1.0" encoding="UTF-8"?>
<MCConfiguration>
<ConfigVersion>2</ConfigVersion>
<pwm_mode>1</pwm_mode>
<comm_mode>0</comm_mode>
<motor_type>2</motor_type>
<sensor_mode>0</sensor_mode>
<l_current_max>20.65</l_current_max>
<l_current_min>-20.65</l_current_min>
<l_in_current_max>15</l_in_current_max>
@leocelente
leocelente / TUTORIAL.md
Last active September 18, 2021 20:51
Tutorial GitHub e CubeIDE

Tutorial GitHub e CubeIDE

Adicionar um projeto no GitHub

  • Criar o projeto normalmente pela CubeIDE
  • Criar o repositório git (local) nele git init via terminal (GitBash)
  • Criar o repositorio no GitHub (remote)
  • Adicionar o remote no repositório local git remote add origin <url>
  • Push o projeto pro github

Para usar Git na CubeIDE

  • Instale a Extensão EGit para Eclipse
@leocelente
leocelente / meta_matrix.cpp
Created June 16, 2021 04:11
Calculating matrix composition sizes in constexpr time and runtime. C++20 using TMP library brigand. https://godbolt.org/z/KEoWP8G3n
// https://godbolt.org/z/KEoWP8G3n
#include <fmt/core.h>
#include <array>
#include <brigand/algorithms.hpp>
#include <brigand/functions.hpp>
#include <brigand/sequences.hpp>
#include <brigand/types.hpp>
#include <numeric>
#include <tuple>
@leocelente
leocelente / mekf.m
Last active June 12, 2022 21:15
Multiplicative Extended Kalman Filter for Attitude Quaternion Estimation. Intended for @zenitheesc CubeSats
clc; clear all; close all;
warning('off','Octave:data-file-in-path')
addpath 'igrf/'
data = csvread("../python/simulation.csv");
% [time, position, velocity, attitude, omega, B, gyroscope, gps])
% 1 2:4 5:7 8:11 12:14 15:17 18:20 21:23
sim_time = data(:, 1)';
attitude = data(:, 8:11)';
sim_gyro = data(:, 18:20)';
@leocelente
leocelente / main.cpp
Last active August 23, 2021 18:09
Snippets de C++ com várias abstrações - RAII, SFINAE - que compilam com custo zero em assembly; https://godbolt.org/z/31eh1q
// Compilar com o Compiler-Explorer -O1
// https://godbolt.org/z/31eh1q
#include <type_traits>
/* BIBLIOTECA GENERICA*/
template <class Lambda, class FunctorOpen, class FunctorClose, class... Args>
constexpr void wrap(Lambda l, FunctorOpen i, FunctorClose f, Args... p) {
i(p...);
l();
f(p...);
@leocelente
leocelente / launch.json
Created January 7, 2021 19:23
Sync and Debug (gdbserver) C/C++ programs in a Raspberry-Pi with SSH and rsync using VSCode Tasks
{
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "Attach to gdbserver",
"executable": "./a.out",
"target": "XXX.XXX.XXX.XXX:2345",
"remote": true,