From 126edeb2696bb7635a9607b5d6bac8e21a4507c1 Mon Sep 17 00:00:00 2001 From: Erik Andresen Date: Thu, 31 Mar 2016 20:41:45 +0200 Subject: [PATCH] addded script to get motor step response --- config/razor.yaml | 4 ++-- scripts/step_response.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 scripts/step_response.py diff --git a/config/razor.yaml b/config/razor.yaml index 5b48693..48c57b2 100644 --- a/config/razor.yaml +++ b/config/razor.yaml @@ -23,8 +23,8 @@ magn_z_max: 596 # extended calibration calibration_magn_use_extended: true -magn_ellipsoid_center: [250.567, 49.8387, -698.641] -magn_ellipsoid_transform: [[0.940458, 0.0129812, 0.0164252], [0.0129812, 0.947417, 0.0255152], [0.0164252, 0.0255152, 0.978453]] +magn_ellipsoid_center: [252.957, 54.6821, -690.632] +magn_ellipsoid_transform: [[0.953315, 0.00715770, 0.00266159], [0.00715770, 0.931906, 0.0360847], [0.00266159, 0.0360847, 0.979971]] # AHRS to robot calibration imu_yaw_calibration: 0.0 diff --git a/scripts/step_response.py b/scripts/step_response.py new file mode 100755 index 0000000..9f74ab9 --- /dev/null +++ b/scripts/step_response.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-15 -*- + +import struct +from time import sleep +from i2c import i2c_write_reg, i2c_read_reg + + +def set_pwm(val): + i2c_write_reg(0x50, 0x1, struct.pack(">H", val)) + i2c_write_reg(0x50, 0x3, struct.pack(">H", val)) + i2c_write_reg(0x50, 0x5, struct.pack(">H", val)) + i2c_write_reg(0x50, 0x7, struct.pack(">H", val)) + +if __name__ == "__main__": + set_pwm(210) + sleep(3) + set_pwm(0) -- 2.39.2