Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlaySwitcher内で前回コマンド遷移時の状態記録が抜けていたのを修正 #153

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -69,7 +69,7 @@
// TODO(HansRobo): robocup_ssl_msgs/msg/Refereeをもう少しわかりやすい形式にする必要あり
play_situation_msg.stage = msg.stage;

if (latest_raw_referee_command != msg.command) {

Check warning on line 72 in crane_play_switcher/src/play_switcher.cpp

View workflow job for this annotation

GitHub Actions / BuildAndRun (humble)

comparison of integer expressions of different signedness: ‘int’ and ‘const _command_type’ {aka ‘const unsigned int’} [-Wsign-compare]
//-----------------------------------//
// NORMAL_START
//-----------------------------------//
Expand Down Expand Up @@ -132,7 +132,11 @@
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 @@ -161,7 +165,7 @@
// コマンドが更新されているかを調べる
if (
next_play_situation != std::nullopt &&
next_play_situation.value() != play_situation_msg.command) {

Check warning on line 168 in crane_play_switcher/src/play_switcher.cpp

View workflow job for this annotation

GitHub Actions / BuildAndRun (humble)

comparison of integer expressions of different signedness: ‘int’ and ‘crane_msgs::msg::PlaySituation_<std::allocator<void> >::_command_type’ {aka ‘unsigned int’} [-Wsign-compare]
play_situation_msg.command = next_play_situation.value();
play_situation_msg.reason_text = inplay_command_info.reason;
RCLCPP_INFO(get_logger(), "---");
Expand All @@ -175,6 +179,9 @@
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
Loading