Skip to content

Commit

Permalink
pre-commit run
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshihiro Kogure <[email protected]>
  • Loading branch information
YoshihiroKogure committed Jan 1, 2025
1 parent f88f2ce commit 1facaf9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions control_data_collecting_tool/scripts/courses/base_course.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_target_velocity(
mask_vel_steer,
):
return None

def get_target_pedal_input(
self,
nearestIndex,
Expand Down Expand Up @@ -175,4 +175,4 @@ def update_trajectory_points(
collected_data_counts_of_vel_acc,
collected_data_counts_of_vel_steer,
):
return nearestIndex, *self.return_trajectory_points(yaw_offset, rectangle_center_position)
return nearestIndex, *self.return_trajectory_points(yaw_offset, rectangle_center_position)
Original file line number Diff line number Diff line change
Expand Up @@ -826,9 +826,9 @@ def __init__(self, step: float, param_dict):
self.trajectory_nearly_straight_clock_wise[self.steer_list[i]] = trajectory

# Generate and store counterclockwise trajectories by reversing the clockwise trajectory.
self.trajectory_nearly_straight_counter_clock_wise[
self.steer_list[i]
] = reverse_trajectory_segment(trajectory)
self.trajectory_nearly_straight_counter_clock_wise[self.steer_list[i]] = (
reverse_trajectory_segment(trajectory)
)

# Generate trajectories for changing directions (turning).

Expand Down Expand Up @@ -1198,16 +1198,22 @@ def get_target_pedal_input(
if self.vehicle_phase == "acceleration":
target_pedal_input = self.target_accel_pedal_input_on_segmentation + 0.05 * sine
if current_time - self.acceleration_start_time > self.max_phase_time:
target_pedal_input = self.params.accel_pedal_input_max / 2 * sine + self.params.accel_pedal_input_max / 2
target_pedal_input = (
self.params.accel_pedal_input_max / 2 * sine
+ self.params.accel_pedal_input_max / 2
)
if current_vel > max_velocity:
self.vehicle_phase = "deceleration"
self.deceleration_start_time = current_time

# Handle deceleration phase
if self.vehicle_phase == "deceleration":
target_pedal_input = - self.target_brake_pedal_input_on_segmentation - 0.05 * sine
target_pedal_input = -self.target_brake_pedal_input_on_segmentation - 0.05 * sine
if current_time - self.deceleration_start_time > self.max_phase_time:
target_pedal_input = - self.params.brake_pedal_input_max / 2 * sine - self.params.brake_pedal_input_max / 2
target_pedal_input = (
-self.params.brake_pedal_input_max / 2 * sine
- self.params.brake_pedal_input_max / 2
)
if current_vel < 0.05:
self.updated_target_velocity = False

Expand Down Expand Up @@ -1306,4 +1312,4 @@ def get_boundary_points(self):
boundary_points.append([point_x, point_y])

# Store the boundary points as a numpy array
self.boundary_points = np.array(boundary_points)
self.boundary_points = np.array(boundary_points)
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ def callback_trajectory_generator(self):
msg = Bool()
msg.data = True
self.pub_stop_request_.publish(msg)
self.get_logger().error(f"Control mode {self.CONTROL_MODE} is not supported when the course is {self.COURSE_NAME}")
self.get_logger().error(
f"Control mode {self.CONTROL_MODE} is not supported when the course is {self.COURSE_NAME}"
)
elif (
self.CONTROL_MODE == "external_acceleration_cmd"
or self.CONTROL_MODE == "external_actuation_cmd"
Expand Down

0 comments on commit 1facaf9

Please sign in to comment.