Skip to content

Commit bbb5956

Browse files
committed
Merge remote-tracking branch 'origin/main' into rl_motion_framework
2 parents b4789af + 4f07f36 commit bbb5956

78 files changed

Lines changed: 6464 additions & 1178 deletions

File tree

Some content is hidden

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

pixi.lock

Lines changed: 799 additions & 1090 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ args = [{ arg = "package", default = "" }]
2525
description = "Cleans build and install files for all ROS 2 packages or a specific one if given."
2626

2727
[tasks.test]
28-
cmd = "colcon test --event-handlers console_direct+ --return-code-on-test-failure "
28+
cmd = "colcon test --packages-ignore=audio_common --event-handlers console_direct+ --return-code-on-test-failure "
2929
description = "Runs tests for all ROS 2 packages. Add --packages-select <package names> to test specific packages."
3030

3131
[dependencies]
@@ -39,6 +39,7 @@ pkg-config = ">=0.29.2,<0.30"
3939

4040
[feature.ros.dependencies]
4141
# Misc dependencies for our ROS 2 packages
42+
alsa-plugins = ">=1.2.12,<2"
4243
beartype = ">=0.22.6,<0.23"
4344
breathe = ">=4.36.0,<5"
4445
cmake = "<3.30" # Constraint to avoid issues with deprecated features in newer cmake versions
@@ -53,6 +54,7 @@ ipython = ">=9.7.0,<10"
5354
jaxtyping = ">=0.3.2,<0.4"
5455
jinja2 = ">=3.1.6,<4"
5556
libboost-devel = ">=1.86.0,<2"
57+
libflac = "==1.4.3"
5658
libnuma = ">=2.0.18,<3"
5759
libopencv = ">=4.11.0,<5"
5860
libprotobuf = ">=6.31.1,<7"
@@ -64,6 +66,7 @@ opencv = ">=4.11.0,<5"
6466
paramiko = ">=4.0.0,<5"
6567
pkg-config = ">=0.29.2,<0.30"
6668
playsound = ">=1.3.0,<2"
69+
portaudio = ">=19.7.0,<20"
6770
protobuf = ">=6.31.1,<7"
6871
psutil = ">=7.1.3,<8"
6972
pthread-stubs = ">=0.4,<0.5"
@@ -86,6 +89,7 @@ colcon-common-extensions = ">=0.3.0,<0.4"
8689
colcon-notification = ">=0.3.0,<0.4"
8790
ros-jazzy-action-msgs = ">=2.0.3,<3"
8891
ros-jazzy-ament-cmake = ">=2.5.4,<3"
92+
ros-jazzy-ament-cmake-clang-format = ">=0.17.3,<0.18"
8993
ros-jazzy-ament-cmake-mypy = ">=0.17.3,<0.18"
9094
ros-jazzy-ament-copyright = ">=0.17.3,<0.18"
9195
ros-jazzy-ament-flake8 = ">=0.17.3,<0.18"
@@ -133,6 +137,7 @@ ros-jazzy-rosbridge-suite = ">=2.3.0,<3"
133137
ros-jazzy-rosgraph-msgs = ">=2.0.3,<3"
134138
ros-jazzy-rosidl-default-generators = ">=1.6.0,<2"
135139
ros-jazzy-rosidl-default-runtime = ">=1.6.0,<2"
140+
ros-jazzy-rosidl-runtime-c = ">=4.6.7,<5"
136141
ros-jazzy-rqt-gui = ">=1.6.0,<2"
137142
ros-jazzy-rqt-gui-py = ">=1.6.0,<2"
138143
ros-jazzy-sensor-msgs = ">=5.3.6,<6"
@@ -167,11 +172,11 @@ ros-jazzy-bio-ik-msgs = ">=0.0.0,<0.0.1"
167172
ros-jazzy-biped-interfaces = ">=0.0.0,<0.0.1"
168173
ros-jazzy-bitbots-tf-buffer = ">=1.0.0,<2"
169174
ros-jazzy-ros2-python-extension = ">=1.0.0,<2"
170-
ros-jazzy-audio-common = ">=0.3.15,<0.4"
171175
ros-jazzy-dynamic-stack-decider = ">=0.5.3,<0.6"
172176
ros-jazzy-dynamic-stack-decider-visualization = ">=0.2.1,<0.3"
173-
ros-jazzy-game-controller-hl = ">=1.1.0,<2"
174-
ros-jazzy-game-controller-hl-interfaces = ">=0.0.1,<0.0.2"
177+
# To be replaced with ros-jazzy-game-controller-hsl once the new version is released upstream
178+
# ros-jazzy-game-controller-hl = ">=1.1.0,<2"
179+
# ros-jazzy-game-controller-hl-interfaces = ">=0.0.1,<0.0.2"
175180
ros-jazzy-humanoid-base-footprint = ">=0.1.2,<0.2"
176181
ros-jazzy-ipm-image-node = ">=0.0.0,<0.0.1"
177182
ros-jazzy-ipm-interfaces = ">=0.0.0,<0.0.1"
@@ -240,6 +245,7 @@ RMW_IMPLEMENTATION = "rmw_cyclonedds_cpp"
240245
COLCON_LOG_LEVEL = "30"
241246
PYTHONWARNINGS="ignore:::setuptools.command.install,ignore:::setuptools.command.easy_install,ignore:::pkg_resources,ignore:easy_install command is deprecated,ignore:setup.py install is deprecated"
242247
WEBOTS_HOME = "$CONDA_PREFIX/share/webots"
248+
ALSA_PLUGIN_DIR = "/usr/lib/x86_64-linux-gnu/alsa-lib"
243249

244250
[feature.ros.activation]
245251
scripts = [

scripts/deploy/tasks/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def _build(self, connections: Group) -> GroupResult:
6262
:return: The results of the task.
6363
"""
6464
print_debug("Building packages")
65-
cmd = f"cd {self._remote_workspace} && pixi run --environment robot build {self._package}"
65+
66+
cmd = f"cd {self._remote_workspace} && chrt -r 1 taskset -c 0-9 pixi run --environment robot build {self._package}"
6667

6768
print_debug(f"Calling '{cmd}'")
6869
try:

src/bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/game_status_capsule.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from typing import Optional
2-
31
from bitbots_utils.utils import get_parameters_from_other_node
2+
from builtin_interfaces.msg import Time as TimeMsg
43
from game_controller_hsl_interfaces.msg import GameState
4+
from rclpy.time import Time
55
from std_msgs.msg import Bool
66

77
from bitbots_blackboard.capsules import AbstractBlackboardCapsule
@@ -19,8 +19,9 @@ def __init__(self, node, blackboard=None):
1919
self.unpenalized_time: float = 0.0
2020
self.last_goal_from_us_time = -86400.0
2121
self.last_goal_time = -86400.0
22-
self.free_kick_kickoff_team: Optional[bool] = None
22+
self.free_kick_kickoff_team: bool | None = None
2323
self.game_controller_stop: bool = False
24+
self.last_timestep_whistle_detected: Time | None = None
2425
# publish stopped msg for hcm
2526
self.stop_pub = node.create_publisher(Bool, "game_controller/stop_msg", 1)
2627

@@ -127,3 +128,6 @@ def gamestate_callback(self, gamestate_msg: GameState) -> None:
127128
"""
128129
self.last_update = self._node.get_clock().now().nanoseconds / 1e9
129130
self.gamestate = gamestate_msg
131+
132+
def whistle_detection_callback(self, msg: TimeMsg) -> None:
133+
self.last_timestep_whistle_detected = Time.from_msg(msg)

src/bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/world_model_capsule.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ def __init__(self, node, blackboard):
5858
self.map_margin: float = self._node.get_parameter("map_margin").value
5959

6060
# Ball state
61+
# The ball in the map frame (default to the center of the field if ball is not seen yet)
6162
self._ball: PointStamped = PointStamped(
62-
header=Header(stamp=Time(clock_type=ClockType.ROS_TIME), frame_id=self.map_frame)
63-
) # The ball in the map frame (default to the center of the field if ball is not seen yet)
63+
header=Header(stamp=Time(clock_type=ClockType.ROS_TIME).to_msg(), frame_id=self.map_frame)
64+
)
6465
self._ball_covariance: np.ndarray = np.zeros((2, 2)) # Covariance of the ball
6566

6667
# Publisher for visualization in RViZ
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from bitbots_blackboard.body_blackboard import BodyBlackboard
2+
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
3+
4+
5+
class WhistleDetected(AbstractDecisionElement):
6+
blackboard: BodyBlackboard
7+
8+
def __init__(self, blackboard, dsd, parameters):
9+
super().__init__(blackboard, dsd, parameters)
10+
self.previous_timestep_whistle_detected = self.blackboard.gamestate.last_timestep_whistle_detected
11+
12+
def perform(self, reevaluate=False):
13+
"""
14+
Returns "DETECTED" if a whistle was detected while the decision element was active, as part of the
15+
DSD stack. If we have detected a whistle previously, but not during this decision element being on
16+
the decision stack it counts as "NOT_DETECTED".
17+
"""
18+
if self.previous_timestep_whistle_detected == self.blackboard.gamestate.last_timestep_whistle_detected:
19+
return "NOT_DETECTED"
20+
21+
return "DETECTED"
22+
23+
def get_reevaluate(self):
24+
return True

src/bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ $BallSeen
130130
SECOND --> #SupporterRole
131131
THIRD --> #DefensePositioning
132132

133+
#PlayingBehavior
134+
$SecondaryStateDecider
135+
PENALTYSHOOT --> #PenaltyShootoutBehavior
136+
TIMEOUT --> #StandAndLook
137+
ELSE --> $SecondaryStateTeamDecider
138+
OUR --> #NormalBehavior
139+
OTHER --> #Placing
140+
NORMAL --> #NormalBehavior
141+
OVERTIME --> #NormalBehavior
142+
133143
-->BodyBehavior
134144
$IsPenalized
135145
YES --> #DoNothing
@@ -143,23 +153,18 @@ $IsPenalized
143153
NO --> $DoOnce
144154
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:2
145155
DONE --> #PositioningReady
146-
SET --> $SecondaryStateDecider
147-
PENALTYSHOOT --> $SecondaryStateTeamDecider
148-
OUR --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @Stand
149-
OTHER --> $BallSeen
150-
YES --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @TrackBall + r:false, @PlayAnimationGoalieArms + r:false, @Stand // goalie only needs to care about the ball
151-
NO --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @LookAtFieldFeatures + r:false, @PlayAnimationGoalieArms + r:false, @Stand
152-
ELSE --> #StandAndLook
156+
SET --> $WhistleDetected
157+
DETECTED --> #PlayingBehavior
158+
NOT_DETECTED --> $SecondaryStateDecider
159+
PENALTYSHOOT --> $SecondaryStateTeamDecider
160+
OUR --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @Stand // we need to also see the goalie
161+
OTHER --> $BallSeen
162+
YES --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @TrackBall + r:false, @PlayAnimationGoalieArms + r:false, @Stand // goalie only needs to care about the ball
163+
NO --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @LookAtFieldFeatures + r:false, @PlayAnimationGoalieArms + r:false, @Stand
164+
ELSE --> #StandAndLook
153165
FINISHED --> $CurrentScore
154166
AHEAD --> @Stand + duration:0.5 + r:false, @PlaySound + file:fanfare.wav, @PlayAnimationCheering + r:false, @GetWalkready + r:false, @LookForward, @Stand
155167
ELSE --> #Init
156-
PLAYING --> $SecondaryStateDecider
157-
PENALTYSHOOT --> #PenaltyShootoutBehavior
158-
TIMEOUT --> #StandAndLook
159-
ELSE --> $SecondaryStateTeamDecider
160-
OUR --> #NormalBehavior
161-
OTHER --> #Placing
162-
NORMAL --> #NormalBehavior
163-
OVERTIME --> #NormalBehavior
168+
PLAYING --> #PlayingBehavior
164169
STANDBY --> #StandAndLook
165170
STOPPED --> #DoNothing

src/bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/body_behavior.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import rclpy
44
from bitbots_blackboard.body_blackboard import BodyBlackboard
55
from bitbots_tf_buffer import Buffer
6+
from builtin_interfaces.msg import Time as TimeMsg
67
from dynamic_stack_decider.dsd import DSD
78
from game_controller_hsl_interfaces.msg import GameState
89
from geometry_msgs.msg import PoseWithCovarianceStamped, Twist
@@ -75,6 +76,13 @@ def __init__(self, node: Node):
7576
qos_profile=1,
7677
callback_group=MutuallyExclusiveCallbackGroup(),
7778
)
79+
node.create_subscription(
80+
TimeMsg,
81+
"whistle_detected",
82+
blackboard.gamestate.whistle_detection_callback,
83+
qos_profile=1,
84+
callback_group=MutuallyExclusiveCallbackGroup(),
85+
)
7886

7987
def loop(self):
8088
try:

src/bitbots_behavior/bitbots_body_behavior/package.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@
3030
<depend>soccer_vision_3d_msgs</depend>
3131
<depend>tf_transformations</depend>
3232
<depend>tf2</depend>
33-
<test_depend>ament_mypy</test_depend>
33+
<depend>std_msgs</depend>
34+
<test_depend>ament_mypy</test_depend>
3435

35-
<test_depend>python3-pytest</test_depend>
36+
<test_depend>python3-pytest</test_depend>
3637

37-
<export>
38-
<rosdoc config="rosdoc.yaml"/>
39-
<bitbots_documentation>
40-
<status>starts</status>
41-
<language>python3</language>
42-
</bitbots_documentation>
43-
<build_type>ament_python</build_type>
44-
</export>
45-
</package>
38+
<export>
39+
<rosdoc config="rosdoc.yaml"/>
40+
<bitbots_documentation>
41+
<status>starts</status>
42+
<language>python3</language>
43+
</bitbots_documentation>
44+
<build_type>ament_python</build_type>
45+
</export>
46+
</package>

src/bitbots_misc/bitbots_bringup/launch/README.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)