diff --git a/ansible/roles/donkeycar/tasks/main.yml b/ansible/roles/donkeycar/tasks/main.yml index 5d134d2b..d6e9b686 100644 --- a/ansible/roles/donkeycar/tasks/main.yml +++ b/ansible/roles/donkeycar/tasks/main.yml @@ -38,7 +38,7 @@ dest: /home/pi/projects/ force: yes single_branch: yes - version: main + version: eedd7eddbfb209006066bb716eb8e68d5d68d3a5 - name: Create python3 virtual environment & install tensorflow become: yes diff --git a/ansible/roles/mycar/files/custom/car/parts/car_manager_part.py b/ansible/roles/mycar/files/custom/car/parts/car_manager_part.py index 83385924..e8f7fa5a 100644 --- a/ansible/roles/mycar/files/custom/car/parts/car_manager_part.py +++ b/ansible/roles/mycar/files/custom/car/parts/car_manager_part.py @@ -110,7 +110,8 @@ def run_threaded(self, controller_x_pressed: Optional[bool]=False, inverted: Optional[bool]=False, scale: Optional[float]=0.5, - cam_image_array: Optional[Any] = None + cam_image_array: Optional[Any] = None, + use_pilot_angle: Optional[bool] = None ) -> Tuple[float, str, bool, bool, float, float, str]: """ :param user_throttle: User throttle value @@ -143,7 +144,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time, laptimer_laps_total, controller_x_pressed, - cam_image_array + cam_image_array, + use_pilot_angle ) return res diff --git a/ansible/roles/mycar/files/custom/car/services/jobs/job.py b/ansible/roles/mycar/files/custom/car/services/jobs/job.py index d79c94b8..7bef8903 100644 --- a/ansible/roles/mycar/files/custom/car/services/jobs/job.py +++ b/ansible/roles/mycar/files/custom/car/services/jobs/job.py @@ -55,7 +55,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time: Optional[datetime] = None, laptimer_laps_total: Optional[int] = None, controller_x_pressed: Optional[bool] = False, - cam_image_array: Optional[Any] = None + cam_image_array: Optional[Any] = None, + use_pilot_angle: Optional[bool] = None ) -> Tuple[float, str, bool, bool]: """ Part run threaded, is call with all donekcarmanacer I/O. diff --git a/ansible/roles/mycar/files/custom/car/services/jobs/job_ai_assisted.py b/ansible/roles/mycar/files/custom/car/services/jobs/job_ai_assisted.py index 6525724f..0000ef84 100644 --- a/ansible/roles/mycar/files/custom/car/services/jobs/job_ai_assisted.py +++ b/ansible/roles/mycar/files/custom/car/services/jobs/job_ai_assisted.py @@ -83,7 +83,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time: Optional[datetime] = None, laptimer_laps_total: Optional[int] = None, controller_x_pressed: Optional[bool] = False, - cam_image_array: Optional[Any] = None + cam_image_array: Optional[Any] = None, + use_pilot_angle: Optional[bool] = None ) -> Tuple[float, str, bool]: """ Part run_threaded call. @@ -104,7 +105,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time, laptimer_laps_total, controller_x_pressed, - cam_image_array) + cam_image_array, + use_pilot_angle) # Default values user_throttle = 0.0 @@ -113,7 +115,7 @@ def run_threaded(self, recording_state = False pilot_angle = 0 pilote_throttle = 0 - user_mode = 'auto_pilote' + user_mode = 'local_angle' if use_pilot_angle else 'local' if self.drive_stage == JobAiAssistedStage.MODEL_DRIVING: laptimer_reset_all = self.race_service.handle_laptimer_outputs( diff --git a/ansible/roles/mycar/files/custom/car/services/jobs/job_drive.py b/ansible/roles/mycar/files/custom/car/services/jobs/job_drive.py index ae737f85..9645ebe3 100644 --- a/ansible/roles/mycar/files/custom/car/services/jobs/job_drive.py +++ b/ansible/roles/mycar/files/custom/car/services/jobs/job_drive.py @@ -58,7 +58,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time: Optional[datetime] = None, laptimer_laps_total: Optional[int] = None, controller_x_pressed: Optional[bool] = False, - cam_image_array: Optional[Any] = None + cam_image_array: Optional[Any] = None, + use_pilot_angle: Optional[bool] = None ) -> Tuple[float, str, bool]: """ Part run_threaded call. @@ -81,7 +82,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time, laptimer_laps_total, controller_x_pressed, - cam_image_array) + cam_image_array, + use_pilot_angle) laptimer_reset_all = True if self.drive_stage == JobDriveStage.USER_NOT_CONFIRMED: # user not confirmed yet diff --git a/ansible/roles/mycar/files/custom/car/services/jobs/job_record.py b/ansible/roles/mycar/files/custom/car/services/jobs/job_record.py index 9d2e0478..15736d22 100644 --- a/ansible/roles/mycar/files/custom/car/services/jobs/job_record.py +++ b/ansible/roles/mycar/files/custom/car/services/jobs/job_record.py @@ -106,7 +106,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time: Optional[datetime] = None, laptimer_laps_total: Optional[int] = None, controller_x_pressed: Optional[bool] = False, - cam_image_array: Optional[Any] = None + cam_image_array: Optional[Any] = None, + use_pilot_angle: Optional[bool] = None ) -> Tuple[float, str, bool, bool]: user_throttle, job_name, laptimer_reset_all, recording_state, pilote_angle, pilote_throttle, user_mode = super(JobRecord, self).run_threaded( user_throttle, @@ -117,7 +118,8 @@ def run_threaded(self, laptimer_last_lap_end_date_time, laptimer_laps_total, controller_x_pressed, - cam_image_array) + cam_image_array, + use_pilot_angle) job_name = 'RECORD' user_mode = 'user' diff --git a/ansible/roles/mycar/files/manage.py b/ansible/roles/mycar/files/manage.py index b46dbd00..1a5e4b5d 100755 --- a/ansible/roles/mycar/files/manage.py +++ b/ansible/roles/mycar/files/manage.py @@ -253,7 +253,8 @@ def drive(cfg, model_path=None, use_joystick=False, model_type=None, 'recording', 'controller/x_pressed', 'controller/inverted', - 'controller/scale' + 'controller/scale', + 'controller/use_pilot_angle' ], threaded=True) @@ -302,7 +303,8 @@ def drive(cfg, model_path=None, use_joystick=False, model_type=None, 'controller/x_pressed', 'controller/inverted', 'controller/scale', - 'cam/image_array' + 'cam/image_array', + 'controller/use_pilot_angle' ], outputs=[ 'user/throttle', diff --git a/ansible/roles/mycar/files/my_joystick.py b/ansible/roles/mycar/files/my_joystick.py index 256c4c48..2698f4dc 100644 --- a/ansible/roles/mycar/files/my_joystick.py +++ b/ansible/roles/mycar/files/my_joystick.py @@ -144,6 +144,7 @@ def __init__(self, *args, **kwargs): self.inverted = False super(MyJoystickController, self).__init__(*args, **kwargs) self.state_x_button = False + self.use_pilot_angle = False self.js = None def init_js(self): @@ -191,6 +192,9 @@ def forward_throttle(self): def throttle_stop(self): self.set_throttle(0) + def toggle_use_pilot_angle(self): + self.use_pilot_angle = not self.use_pilot_angle + def init_trigger_maps(self): """ init set of mapping from buttons to function calls @@ -200,7 +204,7 @@ def init_trigger_maps(self): 'b_button': self.go_easy_mode, 'a_button': self.invert_controls, 'x_button': self.x_button_pressed, - 'y_button': self.emergency_stop, + 'y_button': self.toggle_use_pilot_angle, 'right_shoulder': self.increase_max_throttle, 'left_shoulder': self.decrease_max_throttle, 'options': self.toggle_constant_throttle, @@ -298,7 +302,7 @@ def run_threaded(self, img_arr=None, mode=None, recording=None, manager_job_name if o_x_pressed: self.state_x_button = False # resetting it for next turns - return o_angle, o_throttle, o_mode, o_recording, o_x_pressed, self.inverted, self.throttle_scale + return o_angle, o_throttle, o_mode, o_recording, o_x_pressed, self.inverted, self.throttle_scale, self.use_pilot_angle def update(self): while True: