@@ -18,7 +18,7 @@ class RobotAcker(RobotBase):
1818 goal_dim = (3 , 1 ) # the goal dimension, x,y, phi
1919 position_dim = (2 ,1 ) # the position dimension, x, y
2020
21- def __init__ (self , id = 0 , state = np .zeros ((4 , 1 )), vel = np .zeros ((2 , 1 )), goal = np .zeros ((3 , 1 )), shape = [4.6 , 1.6 , 3 , 1.6 ], psi_limit = pi / 4 , step_time = 0.1 , arrive_mode = 'state' , vel_min = [- 4 , - pi / 4 ], vel_max = [4 , pi / 4 ], acce = [inf , inf ], vel_type = 'steer' , car_model = 'car_green.png' , ** kwargs ):
21+ def __init__ (self , id = 0 , state = np .zeros ((4 , 1 )), vel = np .zeros ((2 , 1 )), goal = np .zeros ((3 , 1 )), shape = [4.6 , 1.6 , 3 , 1.6 ], psi_limit = pi / 4 , step_time = 0.1 , arrive_mode = 'state' , vel_min = [- 4 , - pi / 4 ], vel_max = [4 , pi / 4 ], acce = [inf , inf ], vel_type = 'steer' , car_model = 'car_green.png' , edgecolor = 'y' , ** kwargs ):
2222
2323 self .init_vertex = RobotAcker .cal_vertex (shape )
2424 # super(RobotAcker, self).state_dim = RobotAcker.state_dim
@@ -35,6 +35,8 @@ def __init__(self, id=0, state=np.zeros((4, 1)), vel=np.zeros((2, 1)), goal=np.z
3535 self .car_model = car_model
3636 self .update_vertex (self .state )
3737
38+ self .edgecolor = edgecolor
39+
3840 def dynamics (self , state , vel , ** kwargs ):
3941 # The ackermann robot dynamics
4042 # l: wheel base
@@ -170,7 +172,7 @@ def gen_inequal_global(self):
170172
171173 return G , h
172174
173- def plot_robot (self , ax , show_goal = True , goal_color = 'c' , goal_l = 2 , show_text = False , show_traj = False , traj_type = '-g' , show_trail = False , edgecolor = 'y' , trail_type = 'rectangle' , ** kwargs ):
175+ def plot_robot (self , ax , show_goal = True , goal_color = 'c' , goal_l = 2 , show_text = False , show_traj = False , traj_type = '-g' , show_trail = False , trail_type = 'rectangle' , ** kwargs ):
174176 # cur_vertex =
175177 start_x = self .vertex [0 , 0 ]
176178 start_y = self .vertex [1 , 0 ]
@@ -193,7 +195,7 @@ def plot_robot(self, ax, show_goal=True, goal_color='c', goal_l=2, show_text=Fal
193195
194196 if show_trail :
195197 if trail_type == 'rectangle' :
196- car_rect = mpl .patches .Rectangle (xy = (start_x , start_y ), width = self .shape [0 ], height = self .shape [1 ], angle = r_phi_ang , edgecolor = edgecolor , fill = False , alpha = 0.8 , linewidth = 0.8 )
198+ car_rect = mpl .patches .Rectangle (xy = (start_x , start_y ), width = self .shape [0 ], height = self .shape [1 ], angle = r_phi_ang , edgecolor = self . edgecolor , fill = False , alpha = 0.8 , linewidth = 0.8 )
197199 ax .add_patch (car_rect )
198200
199201 elif trail_type == 'circle' :
@@ -214,6 +216,8 @@ def plot_robot(self, ax, show_goal=True, goal_color='c', goal_l=2, show_text=Fal
214216 y_list = [t [1 , 0 ] for t in self .trajectory ]
215217 self .plot_line_list .append (ax .plot (x_list , y_list , traj_type ))
216218
219+ def set_edgecolor (self , edgecolor = 'y' ):
220+ self .edgecolor = edgecolor
217221
218222 def reset (self ):
219223 self .state = self .init_state .copy ()
0 commit comments