add left turn
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
from lib import semicircle_generator, semicircle2_generator
|
||||
from lib import path_rotate_z
|
||||
import numpy as np
|
||||
from collections import deque
|
||||
|
||||
|
||||
def gen_forward_path():
|
||||
@ -90,3 +92,23 @@ def gen_fastbackward_path():
|
||||
path[:, 5, :] = mir_lpath
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def gen_leftturn_path():
|
||||
g_steps = 20
|
||||
g_radius = 25
|
||||
assert (g_steps % 4) == 0
|
||||
halfsteps = int(g_steps/2)
|
||||
|
||||
path = semicircle_generator(g_radius, g_steps)
|
||||
mir_path = np.roll(path, halfsteps, axis=0)
|
||||
|
||||
leftturn = np.zeros((g_steps, 6, 3))
|
||||
leftturn[:, 0, :] = np.array(path_rotate_z(path, 45))
|
||||
leftturn[:, 1, :] = np.array(path_rotate_z(mir_path, 0))
|
||||
leftturn[:, 2, :] = np.array(path_rotate_z(path, 315))
|
||||
leftturn[:, 3, :] = np.array(path_rotate_z(mir_path, 225))
|
||||
leftturn[:, 4, :] = np.array(path_rotate_z(path, 180))
|
||||
leftturn[:, 5, :] = np.array(path_rotate_z(mir_path, 135))
|
||||
|
||||
return leftturn
|
||||
|
Reference in New Issue
Block a user