Skip to content

Commit e7a5270

Browse files
committed
WorldModelWrapper移行
1 parent 29a5b62 commit e7a5270

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

utility/crane_msg_wrappers/include/crane_msg_wrappers/world_model_wrapper.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ struct WorldModelWrapper
279279

280280
Ball ball;
281281

282-
PlaySituationWrapper play_situation;
283-
284282
private:
285283
class BallOwnerCalculator
286284
{

utility/crane_msg_wrappers/src/world_model_wrapper.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ WorldModelWrapper::WorldModelWrapper(rclcpp::Node & node)
8282

8383
void WorldModelWrapper::update(const crane_msgs::msg::WorldModel & world_model)
8484
{
85-
play_situation.update(world_model.play_situation);
86-
8785
for (auto & our_robot : ours.robots) {
8886
our_robot->available = false;
8987
}
@@ -244,13 +242,15 @@ auto WorldModelWrapper::PointChecker::isPenaltyArea(const Point & p, double offs
244242
auto WorldModelWrapper::getBallPlacementTarget() const -> std::optional<Point>
245243
{
246244
if (
247-
play_situation.getSituationCommandID() == crane_msgs::msg::PlaySituation::OUR_BALL_PLACEMENT or
248-
play_situation.getSituationCommandID() ==
245+
latest_msg.play_situation.command.value == crane_msgs::msg::PlaySituation::OUR_BALL_PLACEMENT or
246+
latest_msg.play_situation.command.value ==
249247
crane_msgs::msg::PlaySituation::THEIR_BALL_PLACEMENT) {
250-
return play_situation.placement_position;
251-
} else {
252-
return std::nullopt;
248+
const auto designated_position = latest_msg.play_situation.referee_raw.designated_position;
249+
if (not designated_position.empty()) {
250+
return Point(designated_position.front().x / 1000., designated_position.front().y / 1000.);
251+
}
253252
}
253+
return std::nullopt;
254254
}
255255

256256
auto WorldModelWrapper::getBallPlacementArea(const double offset) const -> std::optional<Capsule>

0 commit comments

Comments
 (0)