Skip to content

Instantly share code, notes, and snippets.

@gmsanchez
gmsanchez / mpc_casadi.py
Created October 9, 2015 18:48
Quadcopter MPC Controller
# Control of a quadcopter using pure casadi (version 2.4.0).
import casadi
import casadi.tools as ctools
import numpy as np
import matplotlib.pyplot as plt
# Define model and get simulator.
Delta = .10
@gmsanchez
gmsanchez / collocation_linear_u.py
Created October 13, 2015 20:06
Multiple shooting with linear controls
from os.path import expanduser
home = expanduser("~")
import sys
sys.path.append(home+"/fun/casadi/casadi-2.4.1/")
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
@gmsanchez
gmsanchez / collocation_nonlinear_u.py
Created October 13, 2015 20:07
Multiple shooting with nonlinear controls
from os.path import expanduser
home = expanduser("~")
import sys
sys.path.append(home+"/fun/casadi/casadi-2.4.1/")
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
@gmsanchez
gmsanchez / vdp_multiple_shooting.py
Created October 15, 2015 17:03
VDP multiple shooting
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@gmsanchez
gmsanchez / mysql-docker.sh
Created June 25, 2017 23:13 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@gmsanchez
gmsanchez / nxtlinux.txt
Created August 20, 2017 02:31
Lego NXT Mindstorms configuration on Linux
This file can be found in http://bricxcc.sourceforge.net/nbc/doc/nxtlinux.txt
For ubuntu and other recent linux distributions here is a new procedure that I recommend using to configure your Linux box for use with the NXT:
1. Add a legonxt group. From a terminal prompt type
sudo addgroup legonxt
2. Add your account to the legonxt group. From a terminal prompt type
@gmsanchez
gmsanchez / nexttool.txt
Last active August 23, 2017 17:24
Getting NeXTTool in Ubuntu 16.04 64 bits
Setup nxtOSEK program upload software with enhanced firmware (based on http://lejos-osek.sourceforge.net/installation_linux.htm)
a.NeXTTool (building from source)
Required Packages: libusb-0.1-4 libusb-dev fpc
~$ sudo apt-get install libusb-dev libusb-0.1-4 subversion fpc
Note: fpc is the free pascal compiler
@gmsanchez
gmsanchez / docker_remove.sh
Created September 8, 2017 16:52
Docker: Remove all images and containers
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@gmsanchez
gmsanchez / GPS_AGM.py
Last active January 18, 2018 14:45
Python example for Navio2 GPS and IMU
import navio.util
import navio.ublox
import spidev
import time
import argparse
import sys
import struct
if __name__ == "__main__":
@gmsanchez
gmsanchez / husky_kinetic_setup.bash
Created December 12, 2017 17:53
Clearpath Robotics Husky setup on Ubuntu 16.04 with ROS Kinetic
source /opt/ros/kinetic/setup.bash
mkdir -p ~/husky_kinetic_ws/src
cd ~/husky_kinetic_ws/src
git clone -b kinetic-devel https://github.com/husky/husky.git
cd ~/husky_kinetic_ws/
catkin_make
source devel/setup.bash
roslaunch husky_gazebo husky_empty_world.launch