Skip to content

Instantly share code, notes, and snippets.

View madcowswe's full-sized avatar

Oskar Weigl madcowswe

View GitHub Profile
import odrive
from odrive.enums import *
import time
print("Finding an odrive...")
odrv = odrive.find_any()
axes = [odrv.axis0, odrv.axis1];
# axes = [odrv.axis1];
Connected to ODrive 376E36503137 as odrv0
In [1]: odrv0
Out[1]:
vbus_voltage = 12.1695556640625 (float)
serial_number = 376E36503137 (int)
hw_version_major = 3 (int)
hw_version_minor = 5 (int)
hw_version_variant = 48 (int)
fw_version_major = 0 (int)
fw_version_minor = 4 (int)
@madcowswe
madcowswe / sin_traj.m
Created April 12, 2018 03:44
qjones sin trajectory work in progress
function [y,yd,ydd] = straj(D, Vmax, Amax, dt, V0, Vf)
%TODO: Pass move time
%TODO: Short moves
%Calculate Additional params
Sgn = sign(D);
Df = abs(D);
% Compute Accel/Decel Times
T1 = 2*(Vmax-V0)/Amax;
@madcowswe
madcowswe / gist:8a275b4636301bb2e9f6656df86d740d
Last active February 18, 2018 04:04
TIMING_LOG_ADC_CB_M0_I dump
In [9]: a = a - min(a)
# Timing of TIMING_LOG_ADC_CB_M0_I
In [10]: a
Out[10]:
array([130, 126, 132, 126, 0, 0, 126, 400, 268, 126, 0, 130, 0,
0, 0, 0, 126, 0, 0, 0, 0, 0, 126, 126, 0, 0,
0, 130, 126, 132, 214, 0, 0, 126, 38, 222, 0, 0, 0,
38, 38, 0, 0, 0, 132, 376, 0, 0, 256, 206, 0, 208,
@madcowswe
madcowswe / drv8323.h
Created February 15, 2018 01:37
DRV8323 SPI driver, released into public domain
#ifndef _DRV8323_H_
#define _DRV8323_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "stdbool.h"
#include "stdint.h"
#include "stm32f4xx_hal.h"
@madcowswe
madcowswe / drv8323.c
Created February 15, 2018 01:36
DRV8323 SPI driver, released into public domain
// **************************************************************************
//#include "cmsis_os.h"
#include "drv8323.h"
extern SPI_HandleTypeDef hspi3;
//default values for the DRV8323 registers
uint16_t DRV8323regDrvCtrl =
0 << 9 | //DIS_CPUV
/*
Arduino Library for SyRen/Sabertooth Packet Serial
Copyright (c) 2012-2013 Dimension Engineering LLC
http://www.dimensionengineering.com/arduino
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@madcowswe
madcowswe / cla.html
Last active April 22, 2017 02:18
ODrive Contributor Licence Agreement
<h2 id="i-tmp-title">Contributor Agreement</h2>
<h2 id="i-tmp-subtitle"><span id="i-tmp-contributor-type">Individual</span> Contributor <span id="i-tmp-contributor-exclusivity">Non-Exclusive</span> License Agreement</h2>
<p>Thank you for your interest in contributing to <span id="i-tmp-project-name">ODrive</span> ("We" or "Us").</p>
<p>The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us. To make this document effective, please sign using the CLA assistant on GitHub, which is prompted during the Pull Request process.</p>
<h3>1. DEFINITIONS</h3>