Skip to content

Commit

Permalink
Merge pull request #153 from ibis-ssl/fix/#152
Browse files Browse the repository at this point in the history
PlaySwitcher内で前回コマンド遷移時の状態記録が抜けていたのを修正
  • Loading branch information
HansRobo authored Feb 20, 2024
2 parents 025ac9b + 24ab7e4 commit f02bb14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crane_bringup/launch/play_switcher.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@

<node pkg="crane_sender" exec="sim_sender_node" output="screen">
<param name="no_movement" value="false"/>
<param name="theta_kp" value="5.0"/>
<param name="theta_kp" value="3.0"/>
<param name="theta_ki" value="0.0"/>
<param name="theta_kd" value="1.0"/>
<param name="theta_kd" value="0.1"/>
</node>

<!-- <node pkg="crane_sender" exec="ibis_sender_node" output="screen">-->
Expand Down
9 changes: 8 additions & 1 deletion crane_play_switcher/src/play_switcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ void PlaySwitcher::referee_callback(const robocup_ssl_msgs::msg::Referee & msg)
play_situation_msg.command == PlaySituation::OUR_PENALTY_START) {
if (0.05 <= (last_command_changed_state.ball_position - world_model->ball.pos).norm()) {
next_play_situation = PlaySituation::INPLAY;
inplay_command_info.reason = "INPLAY判定:敵ボールが少なくとも0.05m動いた";
inplay_command_info.reason =
"INPLAY判定:敵ボールが少なくとも0.05m動いた(移動量: " +
std::to_string(
(last_command_changed_state.ball_position - world_model->ball.pos).norm()) +
"m)";
}
}

Expand Down Expand Up @@ -175,6 +179,9 @@ void PlaySwitcher::referee_callback(const robocup_ssl_msgs::msg::Referee & msg)
RCLCPP_INFO(
get_logger(), "PREV_CMD_TIME: %f", (now() - last_command_changed_state.stamp).seconds());

last_command_changed_state.stamp = now();
last_command_changed_state.ball_position = world_model->ball.pos;

// パブリッシュはコマンド更新時のみ
play_situation_pub->publish(play_situation_msg);
}
Expand Down

0 comments on commit f02bb14

Please sign in to comment.