@@ -38,6 +38,16 @@ WorldModelPublisherComponent::WorldModelPublisherComponent(const rclcpp::NodeOpt
38
38
declare_parameter (" team_name" , " ibis-ssl" );
39
39
team_name = get_parameter (" team_name" ).as_string ();
40
40
41
+ declare_parameter (" initial_team_color" , " BLUE" );
42
+ auto initial_team_color = get_parameter (" initial_team_color" ).as_string ();
43
+ if (initial_team_color == " BLUE" ) {
44
+ our_color = Color::BLUE;
45
+ their_color = Color::YELLOW;
46
+ } else {
47
+ our_color = Color::YELLOW;
48
+ their_color = Color::BLUE;
49
+ }
50
+
41
51
sub_referee = this ->create_subscription <robocup_ssl_msgs::msg::Referee>(
42
52
" /referee" , 1 , [this ](const robocup_ssl_msgs::msg::Referee & msg) {
43
53
if (msg.yellow .name == team_name) {
@@ -46,12 +56,18 @@ WorldModelPublisherComponent::WorldModelPublisherComponent(const rclcpp::NodeOpt
46
56
their_color = Color::BLUE;
47
57
our_goalie_id = msg.yellow .goalkeeper ;
48
58
their_goalie_id = msg.blue .goalkeeper ;
59
+ if (not msg.blue_team_on_positive_half .empty ()) {
60
+ on_positive_half = not msg.blue_team_on_positive_half [0 ];
61
+ }
49
62
} else if (msg.blue .name == team_name) {
50
63
// BLUE
51
64
our_color = Color::BLUE;
52
65
their_color = Color::YELLOW;
53
66
our_goalie_id = msg.blue .goalkeeper ;
54
67
their_goalie_id = msg.yellow .goalkeeper ;
68
+ if (not msg.blue_team_on_positive_half .empty ()) {
69
+ on_positive_half = msg.blue_team_on_positive_half [0 ];
70
+ }
55
71
} else {
56
72
std::stringstream what;
57
73
what << " Cannot find our team name, " << team_name << " in referee message. " ;
@@ -64,17 +80,6 @@ WorldModelPublisherComponent::WorldModelPublisherComponent(const rclcpp::NodeOpt
64
80
ball_placement_target_y = msg.designated_position .front ().y / 1000 .;
65
81
}
66
82
});
67
-
68
- declare_parameter (" initial_team_color" , " BLUE" );
69
- auto initial_team_color = get_parameter (" initial_team_color" ).as_string ();
70
- if (initial_team_color == " BLUE" ) {
71
- our_color = Color::BLUE;
72
- their_color = Color::YELLOW;
73
-
74
- } else {
75
- our_color = Color::YELLOW;
76
- their_color = Color::BLUE;
77
- }
78
83
}
79
84
80
85
void WorldModelPublisherComponent::visionDetectionsCallback (
@@ -164,6 +169,7 @@ void WorldModelPublisherComponent::publishWorldModel()
164
169
crane_msgs::msg::WorldModel wm;
165
170
166
171
wm.is_yellow = (our_color == Color::YELLOW);
172
+ wm.on_positive_half = on_positive_half;
167
173
wm.ball_info = ball_info;
168
174
169
175
updateBallContact ();
@@ -196,9 +202,6 @@ void WorldModelPublisherComponent::publishWorldModel()
196
202
wm.goal_size .x = goal_h;
197
203
wm.goal_size .y = goal_w;
198
204
199
- wm.ball_placement_target .x = ball_placement_target_x;
200
- wm.ball_placement_target .y = ball_placement_target_y;
201
-
202
205
wm.our_goalie_id = our_goalie_id;
203
206
wm.their_goalie_id = their_goalie_id;
204
207
0 commit comments