did some work

This commit is contained in:
Pavel Lutskov
2019-01-31 17:44:15 +01:00
parent e368cd9abe
commit 3217b7f841
10 changed files with 323 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
#! /usr/bin/env python
import os
import json
from time import sleep
import rospy
@@ -9,18 +10,36 @@ from naoqi import ALProxy
from controller import inform_controller_factory
#min #max
FW = -1.70, -1.40
BK = -2.20, -2.40
LT = 0.35, 0.53
RT = -0.35, -0.53
LR = 0.45, 0.85
RR = -0.45, -0.85
FW = None
BK = None
LT = None
RT = None
LR = None
RR = None
VMIN = 0.3
VMAX = 1.0
def thirdway(a, b):
return a + (b - a) / 3
def global_init():
global FW, BK, LT, RT, LR, RR
here = os.path.dirname(os.path.realpath(__file__))
with open('{}/../config/default.yaml'.format(here)) as f:
x = json.load(f)
cx, cy, cz = x['cr']
FW = thirdway(cx, x['fw']), x['fw']
BK = thirdway(cx, x['bk']), x['bk']
LT = thirdway(cy, x['lt']), x['lt']
RT = thirdway(cy, x['rt']), x['rt']
LR = thirdway(cz, x['lr']), x['lr']
RR = thirdway(cz, x['rr']), x['rr']
_inform_controller = inform_controller_factory('walker')
@@ -37,11 +56,12 @@ def _speed(pos, interval):
if __name__ == '__main__':
rospy.init_node('teleoperation/walker')
rospy.init_node('walker')
global_init()
rospy.wait_for_service('inform_controller')
ll = tf.TransformListener()
mp = ALProxy('ALMotion', os.environ['NAO_IP'], 9559)
# mp.wakeUp()
mp.wakeUp()
mp.moveInit()
mp.setMoveArmsEnabled(False, False)
@@ -84,7 +104,7 @@ if __name__ == '__main__':
if not permission:
mp.stopMove()
else:
# mp.moveToward(*movement) # DON'T DELETE THIS ONE
mp.moveToward(*movement) # DON'T DELETE THIS ONE
pass
mp.rest()