Skip to content

Commit c3003dd

Browse files
authored
Merge branch 'main' into fix/docs_extrinsic_calibration_command_2
2 parents aba77d1 + 1dfb041 commit c3003dd

File tree

557 files changed

+1282
-831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

557 files changed

+1282
-831
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ RUN apt-get update -y \
3232
tree \
3333
uvcdynctrl \
3434
vim \
35-
vlc \
3635
wget \
3736
x11-apps \
3837
zsh

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"throwin",
113113
"timespec",
114114
"tldr",
115+
"torqueless",
115116
"tqdm",
116117
"unpenalize",
117118
"unpenalized",
@@ -212,7 +213,8 @@
212213
"variant": "cpp",
213214
"regex": "cpp",
214215
"future": "cpp",
215-
"*.ipp": "cpp"
216+
"*.ipp": "cpp",
217+
"span": "cpp"
216218
},
217219
// Tell the ROS extension where to find the setup.bash
218220
// This also utilizes the COLCON_WS environment variable, which needs to be set

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pull-files:
4747
wget \
4848
--no-verbose \
4949
--show-progress \
50+
--timeout=15 \
51+
--tries=2 \
5052
--recursive \
5153
--timestamping \
5254
--no-parent \
@@ -57,6 +59,8 @@ pull-files:
5759
wget \
5860
--no-verbose \
5961
--show-progress \
62+
--timeout=15 \
63+
--tries=2 \
6064
--recursive \
6165
--timestamping \
6266
--no-parent \
@@ -86,7 +90,7 @@ rosdep:
8690
# Initialize rosdep if not already done
8791
[ -f /etc/ros/rosdep/sources.list.d/20-default.list ] || sudo rosdep init
8892
# Update rosdep and install dependencies from meta directory
89-
rosdep update
93+
rosdep update --include-eol-distros
9094
rosdep install --from-paths . --ignore-src --rosdistro iron -y
9195

9296
status:

bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/pathfinding_capsule.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class PathfindingCapsule(AbstractBlackboardCapsule):
2626

2727
def __init__(self, node, blackboard):
2828
super().__init__(node, blackboard)
29-
self.map_frame: str = self._node.get_parameter("map_frame").value
3029
self.position_threshold: str = self._node.get_parameter("pathfinding_position_threshold").value
3130
self.orientation_threshold: str = self._node.get_parameter("pathfinding_orientation_threshold").value
3231

@@ -175,16 +174,21 @@ def get_ball_goal(self, target: BallGoalType, distance: float, side_offset: floa
175174
elif BallGoalType.CLOSE == target:
176175
ball_u, ball_v = self._blackboard.world_model.get_ball_position_uv()
177176
angle = math.atan2(ball_v, ball_u)
178-
ball_point = (ball_u, ball_v, angle, self._blackboard.world_model.base_footprint_frame)
177+
goal_u = ball_u - math.cos(angle) * distance
178+
goal_v = ball_v - math.sin(angle) * distance + side_offset
179+
ball_point = (goal_u, goal_v, angle, self._blackboard.world_model.base_footprint_frame)
179180

180181
else:
181182
self._node.get_logger().error(f"Target {target} for go_to_ball action not implemented.")
182183
return
183184

185+
# Create the goal pose message
184186
pose_msg = PoseStamped()
185-
pose_msg.header.stamp = self._node.get_clock().now().to_msg()
186187
pose_msg.header.frame_id = ball_point[3]
187188
pose_msg.pose.position = Point(x=ball_point[0], y=ball_point[1], z=0.0)
188189
pose_msg.pose.orientation = quat_from_yaw(ball_point[2])
189190

191+
# Convert the goal to the map frame
192+
pose_msg = self._blackboard.tf_buffer.transform(pose_msg, self._blackboard.map_frame)
193+
190194
return pose_msg

bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/team_data_capsule.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ def is_not_goalie(team_data: TeamData) -> bool:
189189
# Count valid team data infos (aka robots with valid team data)
190190
return sum(map(self.is_valid, team_data_infos))
191191

192+
def get_is_goalie_active(self) -> bool:
193+
def is_a_goalie(team_data: TeamData) -> bool:
194+
return team_data.strategy.role == Strategy.ROLE_GOALIE
195+
196+
# Get the team data infos for all robots (ignoring the robot id/name)
197+
team_data_infos = self.team_data.values()
198+
199+
# Remove none goalie Data
200+
team_data_infos = filter(is_a_goalie, team_data_infos)
201+
202+
# Count valid team data infos (aka robots with valid team data)
203+
return sum(map(self.is_valid, team_data_infos)) == 1
204+
192205
def get_own_time_to_ball(self) -> float:
193206
return self.own_time_to_ball
194207

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/actions/go_to.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, blackboard, dsd, parameters):
5656
"""Go to an absolute position on the field"""
5757
super().__init__(blackboard, dsd, parameters)
5858
self.point = float(parameters.get("x", 0)), float(parameters.get("y", 0)), float(parameters.get("t", 0))
59+
self.blocking = parameters.get("blocking", True)
5960

6061
def perform(self, reevaluate=False):
6162
pose_msg = PoseStamped()
@@ -64,11 +65,26 @@ def perform(self, reevaluate=False):
6465

6566
pose_msg.pose.position.x = self.point[0]
6667
pose_msg.pose.position.y = self.point[1]
67-
pose_msg.pose.position.z = 0
68+
pose_msg.pose.position.z = 0.0
6869
pose_msg.pose.orientation = quat_from_yaw(math.radians(self.point[2]))
6970

7071
self.blackboard.pathfinding.publish(pose_msg)
7172

73+
if not self.blocking:
74+
self.pop()
75+
76+
77+
class GoToAbsolutePositionFieldFraction(GoToAbsolutePosition):
78+
def __init__(self, blackboard, dsd, parameters):
79+
"""Go to an absolute position of the field, specified by the fraction of the field size"""
80+
super().__init__(blackboard, dsd, parameters)
81+
point = float(parameters.get("x", 0)), float(parameters.get("y", 0)), float(parameters.get("t", 0))
82+
self.point = (
83+
point[0] * self.blackboard.world_model.field_length / 2,
84+
point[1] * self.blackboard.world_model.field_width / 2,
85+
self.point[2],
86+
)
87+
7288

7389
class GoToOwnGoal(GoToAbsolutePosition):
7490
def __init__(self, blackboard, dsd, parameters):
@@ -77,7 +93,7 @@ def __init__(self, blackboard, dsd, parameters):
7793
self.point = (
7894
self.blackboard.world_model.get_map_based_own_goal_center_xy()[0],
7995
self.blackboard.world_model.get_map_based_own_goal_center_xy()[1],
80-
parameters,
96+
self.point[2],
8197
)
8298

8399

@@ -88,12 +104,12 @@ def __init__(self, blackboard, dsd, parameters):
88104
self.point = (
89105
self.blackboard.world_model.get_map_based_opp_goal_center_xy()[0],
90106
self.blackboard.world_model.get_map_based_opp_goal_center_xy()[1],
91-
parameters,
107+
self.point[2],
92108
)
93109

94110

95111
class GoToCenterpoint(GoToAbsolutePosition):
96112
def __init__(self, blackboard, dsd, parameters):
97113
"""Go to the center of the field and look towards the enemy goal"""
98114
super().__init__(blackboard, dsd, parameters)
99-
self.point = 0, 0, 0
115+
self.point = 0.0, 0.0, 0.0

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/actions/go_to_ball.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ def __init__(self, blackboard, dsd, parameters):
2222

2323
self.blocking = parameters.get("blocking", True)
2424
self.distance = parameters.get("distance", self.blackboard.config["ball_approach_dist"])
25+
# Offset so we kick the ball with one foot instead of the center between the feet
26+
self.side_offset = parameters.get("side_offset", 0.08)
2527

2628
def perform(self, reevaluate=False):
27-
pose_msg = self.blackboard.pathfinding.get_ball_goal(self.target, self.distance, 0.08)
29+
pose_msg = self.blackboard.pathfinding.get_ball_goal(self.target, self.distance, self.side_offset)
2830
self.blackboard.pathfinding.publish(pose_msg)
2931

3032
approach_marker = Marker()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from bitbots_blackboard.body_blackboard import BodyBlackboard
2+
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
3+
4+
5+
class GoalieActive(AbstractDecisionElement):
6+
"""
7+
Decides whether the goalie is on field or not
8+
"""
9+
10+
blackboard: BodyBlackboard
11+
12+
def __init__(self, blackboard, dsd, parameters):
13+
super().__init__(blackboard, dsd, parameters)
14+
15+
def perform(self, reevaluate=False):
16+
if self.blackboard.team_data.get_is_goalie_active():
17+
return "YES"
18+
else:
19+
return "NO"
20+
21+
def get_reevaluate(self):
22+
return True
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#SearchBall
2+
@ChangeAction + action:searching, @LookAtFieldFeatures, @WalkInPlace + duration:3, @Turn
3+
4+
#PerformKickLeft
5+
@ChangeAction + action:kicking, @LookAtFront, @WalkKick + foot:left + r:false, @WalkInPlace + duration:1 + r:false, @ForgetBall + r:false, @WalkInPlace + duration:1 + r:false, @LookAtFieldFeatures + r:false
6+
7+
#PerformKickRight
8+
@ChangeAction + action:kicking, @LookAtFront, @WalkKick + foot:right + r:false, @WalkInPlace + duration:1 + r:false, @ForgetBall + r:false, @WalkInPlace + duration:1 + r:false, @LookAtFieldFeatures + r:false
9+
10+
#KickWithAvoidance
11+
$AvoidBall
12+
NO --> $BallClose + distance:%ball_reapproach_dist + angle:%ball_reapproach_angle
13+
YES --> $BallKickArea
14+
NEAR --> $FootSelection
15+
LEFT --> #PerformKickLeft
16+
RIGHT --> #PerformKickRight
17+
FAR --> @ChangeAction + action:going_to_ball, @LookAtFront, @GoToBall + target:close
18+
NO --> @ChangeAction + action:going_to_ball + r:false, @LookAtFieldFeatures + r:false, @AvoidBallActive + r:false, @GoToBall + target:close + blocking:false + distance:%ball_far_approach_dist
19+
YES --> $ReachedPathPlanningGoalPosition + threshold:%ball_far_approach_position_thresh
20+
YES --> @AvoidBallInactive
21+
NO --> @ChangeAction + action:going_to_ball, @LookAtFieldFeatures, @GoToBall + target:close + distance:%ball_far_approach_dist
22+
23+
-->BodyBehavior
24+
$DoOnce
25+
NOT_DONE --> @Stand + duration:15
26+
DONE --> $BallSeen
27+
YES --> #KickWithAvoidance
28+
NO --> #SearchBall

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#SearchBall
2-
@ChangeAction + action:searching, @LookAtFieldFeatures, @WalkInPlace + duration:3, @Turn
2+
$DoOnce
3+
NOT_DONE --> @ChangeAction + action:searching, @LookAtFieldFeatures, @WalkInPlace + duration:3, @Turn + duration:15, @GoToAbsolutePositionFieldFraction + x:0.5 + blocking:false
4+
DONE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.5 + latch:true
5+
NO --> @LookAtFieldFeatures, @GoToAbsolutePositionFieldFraction + x:0.5
6+
YES --> $DoOnce
7+
NOT_DONE --> @Turn + duration:15
8+
DONE --> $DoOnce
9+
NOT_DONE --> @GoToAbsolutePositionFieldFraction + y:1.0 + t:-90 + blocking:false
10+
DONE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.2 + latch:true
11+
YES --> @Stand
12+
NO --> @GoToAbsolutePositionFieldFraction + y:1.0 + t:-90
313

414
#DoNothing
515
@ChangeAction + action:waiting, @LookForward, @Stand
@@ -61,7 +71,9 @@ $GoalieHandlingBall
6171
NO --> #KickWithAvoidance
6272

6373
#DefensePositioning
64-
@LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToDefensePosition
74+
$GoalieActive
75+
YES --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToDefensePosition
76+
NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToBlockPosition
6577

6678
#SupporterRole
6779
$PassStarted
@@ -148,7 +160,7 @@ $IsPenalized
148160
READY --> $AnyGoalScoreRecently + time:50
149161
YES --> #PositioningReady
150162
NO --> $DoOnce
151-
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:1, @GetWalkready + r:false
163+
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:2
152164
DONE --> #PositioningReady
153165
SET --> $SecondaryStateDecider
154166
PENALTYSHOOT --> $SecondaryStateTeamDecider

0 commit comments

Comments
 (0)