Skip to content

Instantly share code, notes, and snippets.

View cggonzal's full-sized avatar
😊

Carlos Gonzalez cggonzal

😊
View GitHub Profile
@cggonzal
cggonzal / quad_symbolic.py
Last active August 15, 2021 01:25
Symbolic computation of a quadcopter model
# see here for model: https://www.cggonzalez.com/blog/model.html
from sympy import symbols, init_printing, Matrix, sin, cos, tan
init_printing()
x_dot, y_dot, z_dot = symbols("x_dot y_dot z_dot")
phi, theta, psi = symbols("phi theta psi")
phi_dot, theta_dot, psi_dot = symbols("phi_dot theta_dot psi_dot")
p, q, r = symbols("p q r")
@cggonzal
cggonzal / README-Template.md
Created April 20, 2019 22:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

your_model.author = 'your name'
your_model.short_description = 'Digit Recognition with MNIST'
your_model.input_description['image'] = 'Takes as input an image of a handwritten digit'
your_model.output_description['output'] = 'Prediction of Digit
from keras.models import load_model
import coremltools
model.save('your_model.h5')
output_labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
your_model = coremltools.converters.keras.convert('your_model.h5', input_names=['image'], output_names=['output'],
class_labels=output_labels, image_input_names='image')
#your_model.author = 'your name'
model.save('your_model.h5')
output_labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
your_model = coremltools.converters.keras.convert('your_model.h5', input_names=['image'], output_names=['output'],
class_labels=output_labels, image_input_names='image')
your_model.save('your_model_name.mlmodel')
output_labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
your_model = coremltools.converters.keras.convert('your_model.h5', input_names=['image'], output_names=['output'],
class_labels=output_labels, image_input_names='image')
model.save('your_model_name.mlmodel')
from keras.models import load_model
import coremltools
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Flatten, MaxPooling2D
from sklearn import datasets
from sklearn.model_selection import train_test_split
digits = datasets.load_digits()
X = digits["images"]
y = digits["target"]
import anki_vector
import time
from PIL import Image
import cv2
import numpy as np
import matplotlib.pyplot as plt
with anki_vector.Robot(enable_camera_feed=True) as robot:
robot.motors.set_head_motor(-5.0) # move head to look at ground
robot.motors.set_wheel_motors(10, 10) # set initial driving direction