|
@@ -1920,6 +1920,9 @@ def main():
|
1920
|
1920
|
#speed = .004
|
1921
|
1921
|
speed = dict['turn_addx']
|
1922
|
1922
|
manual = 0
|
|
1923
|
+ multer = abs(round(((round(lLR, 2) * 100) / 8), 1))
|
|
1924
|
+ if dict['kb_ra'] == 2 or dict['kb_la'] == 2:
|
|
1925
|
+ multer = 1
|
1923
|
1926
|
if own['manual_v2'] == 1:
|
1924
|
1927
|
manual = 1
|
1925
|
1928
|
if abs(linVelocity.x) < 2:
|
|
@@ -1938,55 +1941,63 @@ def main():
|
1938
|
1941
|
turnVel = .01
|
1939
|
1942
|
#light
|
1940
|
1943
|
#if manual and grindhit = true
|
1941
|
|
- if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
|
1942
|
|
- rotation = [0.0, 0.0, (-rotamt)]
|
1943
|
|
- local = False # use world axis
|
1944
|
|
- own.applyRotation( rotation, local)
|
1945
|
|
-
|
1946
|
|
- if onGround:
|
1947
|
|
- #print("light turn")
|
1948
|
|
- if STANCE == 0:
|
1949
|
|
- own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
|
1950
|
|
- if STANCE == 1:
|
1951
|
|
- own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
|
1952
|
|
- if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
|
1953
|
|
- rotation = [0.0, 0.0, rotamt]
|
1954
|
|
- local = False # use world axis
|
1955
|
|
- own.applyRotation( rotation, local)
|
1956
|
|
-
|
1957
|
|
- if onGround:
|
1958
|
|
- #print("light turn")
|
1959
|
|
- if STANCE == 0:
|
1960
|
|
- own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
|
1961
|
|
- if STANCE == 1:
|
1962
|
|
- own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
|
|
1944
|
+ # if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
|
|
1945
|
+ # rotation = [0.0, 0.0, (-rotamt)]
|
|
1946
|
+ # local = False # use world axis
|
|
1947
|
+ # #own.applyRotation( rotation, local)
|
|
1948
|
+
|
|
1949
|
+ # if onGround:
|
|
1950
|
+ # #print("light turn")
|
|
1951
|
+ # if STANCE == 0:
|
|
1952
|
+ # own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
|
|
1953
|
+ # if STANCE == 1:
|
|
1954
|
+ # own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
|
|
1955
|
+ # if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
|
|
1956
|
+ # rotation = [0.0, 0.0, rotamt]
|
|
1957
|
+ # local = False # use world axis
|
|
1958
|
+ # #own.applyRotation( rotation, local)
|
|
1959
|
+
|
|
1960
|
+ # if onGround:
|
|
1961
|
+ # #print("light turn")
|
|
1962
|
+ # if STANCE == 0:
|
|
1963
|
+ # own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
|
|
1964
|
+ # if STANCE == 1:
|
|
1965
|
+ # own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
|
1963
|
1966
|
#medium
|
1964
|
|
- if (lLR > (turnsens * 1.3) or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
|
|
1967
|
+ max_amt = 3
|
|
1968
|
+ if (lLR > (turnsens * 1) or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
|
1965
|
1969
|
#turn left
|
1966
|
1970
|
if rot.z < .4:
|
1967
|
|
- rotation = [0.0, 0.0, (-rotamt * 5)]
|
|
1971
|
+ rotation = [0.0, 0.0, ((-rotamt * 5) * multer)]
|
1968
|
1972
|
if rot.z < .6 and rot.z > .4:
|
1969
|
|
- rotation = [0.0, 0.0, (-rotamt * 2)]
|
|
1973
|
+ rotation = [0.0, 0.0, ((-rotamt * 2) * multer)]
|
1970
|
1974
|
else:
|
1971
|
|
- rotation = [0.0, 0.0, (-rotamt * 1.6)]
|
|
1975
|
+ rotation = [0.0, 0.0, ((-rotamt * 1.6) * multer)]
|
1972
|
1976
|
local = True # use world axis
|
1973
|
1977
|
own.applyRotation( rotation, local)
|
|
1978
|
+ print('rotation = ', rotation)
|
1974
|
1979
|
if onGround:
|
1975
|
1980
|
#print("med turn")
|
1976
|
1981
|
if STANCE == 0:
|
1977
|
1982
|
own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y - turnVel, linVelocity2.z], 1)
|
1978
|
1983
|
if STANCE == 1:
|
1979
|
1984
|
own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y - turnVel, linVelocity2.z], 1)
|
1980
|
|
- if (lLR < (-turnsens * 1.3) or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
|
1981
|
|
- #turn right
|
|
1985
|
+ elif (lLR < (-turnsens * 1) or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
|
|
1986
|
+ #turn right
|
|
1987
|
+ #vert
|
1982
|
1988
|
if rot.z < .4:
|
1983
|
|
- rotation = [0.0, 0.0, (rotamt * 5)]
|
|
1989
|
+ rotation = [0.0, 0.0, ((rotamt * 5) * multer)]
|
|
1990
|
+ #near vert
|
1984
|
1991
|
if rot.z < .6 and rot.z > .4:
|
1985
|
|
- rotation = [0.0, 0.0, (rotamt * 2)]
|
|
1992
|
+ rotation = [0.0, 0.0, ((rotamt * 2) * multer)]
|
|
1993
|
+
|
|
1994
|
+ #normal
|
1986
|
1995
|
else:
|
1987
|
|
- rotation = [0.0, 0.0, (rotamt * 1.6)]
|
|
1996
|
+ rotation = [0.0, 0.0, ((rotamt * 1.6) * multer)]
|
|
1997
|
+
|
1988
|
1998
|
local = True # use world axis
|
1989
|
1999
|
own.applyRotation( rotation, local)
|
|
2000
|
+ print('rotation = ', rotation)
|
1990
|
2001
|
if onGround:
|
1991
|
2002
|
#print("med turn")
|
1992
|
2003
|
if STANCE == 0:
|