Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent 2c92d59 commit d37d2bf
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions crane_world_model_publisher/src/world_model_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,13 @@ void WorldModelPublisherComponent::visionDetectionsCallback(const TrackedFrame &

// ball disappeared 判定
int ball_info_history_size = ball_info_history.size();
if(1 > ball_info_history_size){
if (1 > ball_info_history_size) {
auto last_ball_info_history = ball_info_history[ball_info_history_size - 1];
double elapsed_time_since_last_detected = tracked_frame.timestamp() - last_ball_info_history.detection_time;

double elapsed_time_since_last_detected =
tracked_frame.timestamp() - last_ball_info_history.detection_time;

// 0.5secビジョンから見えていなければ見失った
if(0.5 < elapsed_time_since_last_detected){
if (0.5 < elapsed_time_since_last_detected) {
ball_info.disappeared = true;
}
}
Expand Down Expand Up @@ -540,14 +541,13 @@ void WorldModelPublisherComponent::updateBallContact()
ball_info.pose.x - robot_info[static_cast<uint8_t>(our_color)][i].pose.x,
ball_info.pose.y - robot_info[static_cast<uint8_t>(our_color)][i].pose.y);
// ビジョンがボールを見失っているときにボールセンサが反応している間は、接触しているものとみなす。
if(
ball_sensor_detected[i]
&& not robot_info[static_cast<uint8_t>(our_color)][i].disappeared
&& ball_info.disappeared ){
if (
ball_sensor_detected[i] && not robot_info[static_cast<uint8_t>(our_color)][i].disappeared &&
ball_info.disappeared) {
// ビジョンはボール見失っているけどロボットが保持しているので、ロボットの座標にボールがあることにする
ball_info.pose.x = robot_info[static_cast<uint8_t>(our_color)][i].pose.x;
ball_info.pose.y = robot_info[static_cast<uint8_t>(our_color)][i].pose.y;

robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.is_vision_source = false;
robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.current_time = now;
robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.last_contacted_time = now;
Expand All @@ -557,9 +557,8 @@ void WorldModelPublisherComponent::updateBallContact()
ball_event_detected = true;
}
} else if (
ball_sensor_detected[i]
&& not robot_info[static_cast<uint8_t>(our_color)][i].disappeared
&& ball_distance < 0.3) {
ball_sensor_detected[i] && not robot_info[static_cast<uint8_t>(our_color)][i].disappeared &&
ball_distance < 0.3) {
robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.is_vision_source = false;
robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.current_time = now;
robot_info[static_cast<uint8_t>(our_color)][i].ball_contact.last_contacted_time = now;
Expand Down

0 comments on commit d37d2bf

Please sign in to comment.