From 0e472841a35884091865914bf2f3aa4e7cde2f25 Mon Sep 17 00:00:00 2001 From: Michael Soukup Date: Wed, 6 Aug 2014 14:07:33 +0200 Subject: [PATCH] small changes. --- config.py | 39 +++++++++++++++++++------------ config.py.bak | 57 +++++++++++++++++++++++++++++++++++++++++++--- config.pyc | Bin 1983 -> 2095 bytes ur5controller.py | 2 +- ur5controller.pyc | Bin 12841 -> 12848 bytes 5 files changed, 80 insertions(+), 18 deletions(-) diff --git a/config.py b/config.py index 03f93ee..6d43578 100644 --- a/config.py +++ b/config.py @@ -105,7 +105,7 @@ R_MAX = 0.75 THETA_MIN= -TABLE_ARC/2 THETA_MAX = TABLE_ARC/2 Z_MIN = TABLE_Z + 0.5*BLOCK_DIM -Z_MAX = TABLE_Z + 4.5*BLOCK_DIM #4 blocks high +Z_MAX = TABLE_Z + 2*BLOCK_DIM @@ -123,19 +123,7 @@ Z_MAX = TABLE_Z + 4.5*BLOCK_DIM #4 blocks high # RB:5 # Back:6 # Start:7 -BUTTON_MAP = { - 4: (0, 0, -1), - 5: (0, 0, 1) -} -# Hat switch:0 (All or nothing for direction). returns (+-1, +-1) = (+-x. +-y) -# hx, hy = hat -HATCODE = 0 #set to -1 to avoid polling hat -HX = 10 -HY = 11 -HAT_MAP = { - HX: (0, 1, 0), - HY: (-1, 0, 0) #inverted -} +# # Axes (Not supported) # Joystick left, x-axis:0 # Joystick left, y-axis:1 @@ -143,7 +131,30 @@ HAT_MAP = { # Joystick right, x-axis:4 # Left trigger:2 # Right trigger:5 +# +# Hat switch:0 (All or nothing for direction). returns (+-1, +-1) = (+-x. +-y) +# hx, hy = hat +HATCODE = -1 #set to -1 to avoid polling hat +HX = 10 +HY = 11 +HAT_MAP = { + HX: (0,1,0), + HY: (-1,0,0) #inverted +} + +#BUTTON_MAP = { +# 4: (0,0,-1), +# 5: (0,0,1) +#} +BUTTON_MAP = { #Buttons only (no hat) + 0: (1,0,0), + 3: (-1,0,0), + 1: (0,1,0), + 2: (0,-1,0), + 4: (0,0,-1), + 5: (0,0,1) +} # AUTO/LOOP CONTROL diff --git a/config.py.bak b/config.py.bak index 3559b0f..5325db7 100644 --- a/config.py.bak +++ b/config.py.bak @@ -1,5 +1,5 @@ -# This config file is the one tested and tuned during development. -# Revert to this to reset parameters. +# This is a backup of a working demo configuration. +# Reset parameters by reverting to this. import math DEBUG = True @@ -88,6 +88,9 @@ T_FORCE_VIOLATION = 0.3 # Note that the angular velocity is also [m/s], not [rad/s], to ensure that the robot # moves with constant speed regardless of direction in the polar plane. # IMPORTANT: VEL_Z should be tuned to Z_MIN to avoid smashing into the table. +# +# T_DIR_CHANGE_COOLDOWN is a cooldown between change of commands. With this, the robot +# have a chance to decelerate before changing direction, which smooths out motion. VEL = 0.1 #[m/s] VEL_Z = 0.05 #[m/s] ACC = 0.5 #[m/s^2] @@ -104,10 +107,58 @@ R_MAX = 0.75 THETA_MIN= -TABLE_ARC/2 THETA_MAX = TABLE_ARC/2 Z_MIN = TABLE_Z + 0.5*BLOCK_DIM -Z_MAX = TABLE_Z + 4.5*BLOCK_DIM #4 blocks high +Z_MAX = TABLE_Z + 2*BLOCK_DIM +# GAMEPAD MAP +# +# For the Microsoft xBox 360 controller. Button/axes codes are listed +# below for reference. +# +# Buttons +# A:0 +# B:1 +# X:2 +# Y:3 +# LB:4 +# RB:5 +# Back:6 +# Start:7 +# +# Axes (Not supported) +# Joystick left, x-axis:0 +# Joystick left, y-axis:1 +# Joystick right, x-axis:3 +# Joystick right, x-axis:4 +# Left trigger:2 +# Right trigger:5 +# +# Hat switch:0 (All or nothing for direction). returns (+-1, +-1) = (+-x. +-y) +# hx, hy = hat + +HATCODE = -1 #set to -1 to avoid polling hat +HX = 10 +HY = 11 +HAT_MAP = { + HX: (0,1,0), + HY: (-1,0,0) #inverted +} + +#BUTTON_MAP = { +# 4: (0,0,-1), +# 5: (0,0,1) +#} +BUTTON_MAP = { #Buttons only (no hat) + 0: (1,0,0), + 3: (-1,0,0), + 1: (0,1,0), + 2: (0,-1,0), + 4: (0,0,-1), + 5: (0,0,1) +} + + # AUTO/LOOP CONTROL # # When looping, the robot use the same velocity for r, theta and z. diff --git a/config.pyc b/config.pyc index 311f2532becbb2c6760269833567c3956323d3ae..4ccbc398f18a84df42108c4f5b57abd986bcd53b 100644 GIT binary patch delta 293 zcmXwyy-EW?5Xb*>%k9A)-ie4Y9662V0>*E_*os)k!U(dK&J|nRTKE7qG7lmWtYhsn zsD+(a`T)9n>J0P$%@;G%{C>7jUo+;T^?rJZKTA9heOz@PiUYdHQKy)1*%dHgSHT_F z9=L?9;3DtcvfzyW z=+Yn*L_d@~GOG-+=q}=0Ya7YHjkW-bkL~z6sZk&c@@D(d08e iC%Td2WVByu3a%(2lLY;Dll@L~q$#5|Eo#$jhVBnLE;JAT delta 234 zcmZ24u%BO=`7{Bokec)S7yn{`Px# diff --git a/ur5controller.py b/ur5controller.py index 56cda5e..ece511b 100644 --- a/ur5controller.py +++ b/ur5controller.py @@ -292,7 +292,7 @@ class DemoController(object): v = [pose1[i]-pose0[i] for i in range(len(pose0))] if self.debug: _sum = sum(map(abs, v)) - print "Velocity vector, dt=%.2f: %s. SUM %.3f" % (dt, str([('%.2f' % i) for i in v]), _sum) + print "dt = %.2f, v = ds/dt = %s, |v| = %.3f" % (dt, str([('%.2f' % i) for i in v]), _sum) return sum(map(abs, v)) > threshold diff --git a/ur5controller.pyc b/ur5controller.pyc index 7a34ed56814d69596e6dc5dfe943394aacb05f51..fb30325790515bb06aeb94e4423548340854c33f 100644 GIT binary patch delta 65 zcmZ3PvLS_y`7l1d;Wxg@_xp$sHb RtfNp