Skip to content

Commit 7b97ed1

Browse files
committed
Merge branch 'feature/whistle_detection' into go-first-game
2 parents f28f62b + ca26560 commit 7b97ed1

76 files changed

Lines changed: 5832 additions & 414 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.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ fabric.properties
5151
### ROS template
5252
build/
5353
bin/
54-
lib/
5554
msg_gen/
5655
srv_gen/
5756
msg/*Action.msg

pixi.lock

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

pixi.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ ros-jazzy-bio-ik-msgs = ">=0.0.0,<0.0.1"
165165
ros-jazzy-biped-interfaces = ">=0.0.0,<0.0.1"
166166
ros-jazzy-bitbots-tf-buffer = ">=1.0.0,<2"
167167
ros-jazzy-ros2-python-extension = ">=1.0.0,<2"
168-
ros-jazzy-audio-common = ">=0.3.15,<0.4"
169168
ros-jazzy-dynamic-stack-decider = ">=0.5.3,<0.6"
170169
ros-jazzy-dynamic-stack-decider-visualization = ">=0.2.1,<0.3"
171170
ros-jazzy-game-controller-hl = ">=1.1.0,<2"
@@ -197,6 +196,12 @@ setuptools = "==68.1.2" # Pinning setuptools to avoid issues with colcon build
197196
git = ">=2.52.0,<3" # Otherwise the system git might be used causing ABI issues
198197
curl = ">=8.17.0,<9"
199198
make = ">=4.4.1,<5" # To avoid issues in the CI
199+
libflac = "==1.4.3"
200+
portaudio = ">=19.7.0,<20"
201+
ros-jazzy-ament-cmake-clang-format = ">=0.17.3,<0.18"
202+
ros-jazzy-rosidl-runtime-c = ">=4.6.7,<5"
203+
alsa-plugins = ">=1.2.12,<2"
204+
git-subrepo = ">=0.4.9,<0.5"
200205

201206
[feature.ros.target.linux-64.dependencies]
202207
# For now Webots is only packaged for x86-64 Linux
@@ -233,6 +238,7 @@ RMW_IMPLEMENTATION = "rmw_cyclonedds_cpp"
233238
COLCON_LOG_LEVEL = "30"
234239
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"
235240
WEBOTS_HOME = "$CONDA_PREFIX/share/webots"
241+
ALSA_PLUGIN_DIR = "/usr/lib/x86_64-linux-gnu/alsa-lib"
236242

237243
[feature.ros.activation]
238244
scripts = [
@@ -244,3 +250,4 @@ scripts = [
244250
default = ["ros", "format"] # Full development environment (excluding robot-only deps)
245251
format = ["format"] # Format only environment
246252
robot = ["ros", "format", "robot"] # Robot environment with additional robot-only dependencies
253+

scripts/deploy/deploy_robots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def _parse_arguments(self) -> argparse.Namespace:
118118
parser.add_argument(
119119
"-w",
120120
"--workspace",
121-
default=".",
122-
help="Path to the workspace directory to deploy to. Defaults to the current directory.",
121+
default="~/bitbots_main",
122+
help="Path to the workspace directory to deploy to. Defaults to 'bitbots_main' in $HOME dir.",
123123
)
124124
parser.add_argument("--skip-local-repo-check", action="store_true", help="Skip the local repository check.")
125125

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, node, blackboard=None):
2121
self.last_goal_from_us_time = -86400.0
2222
self.last_goal_time = -86400.0
2323
self.free_kick_kickoff_team: Optional[bool] = None
24+
self.whistle_detected: bool = False
2425
self.game_controller_stop: bool = False
2526
# publish stopped msg for hcm
2627
self.stop_pub = node.create_publisher(Bool, "game_controller/stop_msg", 1)
@@ -135,3 +136,6 @@ def gamestate_callback(self, gamestate_msg: GameState) -> None:
135136
"""
136137
self.last_update = self._node.get_clock().now().nanoseconds / 1e9
137138
self.gamestate = gamestate_msg
139+
140+
def whistle_detection_callback(self, msg) -> None: # MSG type is assumed to be bool for now, prototyping
141+
self.whistle_detected = msg.data # This stays true after the first whistle detection which is incorrect
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.bb = blackboard
11+
self.bb.gamestate.whistle_detected = False
12+
13+
def perform(self, reevaluate=False):
14+
if self.bb.gamestate.whistle_detected:
15+
return "YES"
16+
return "NO"
17+
18+
def get_reevaluate(self):
19+
return True

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ $BallSeen
136136
SECOND --> #SupporterRole
137137
THIRD --> #DefensePositioning
138138

139+
#PlayingBehavior
140+
$SecondaryStateDecider
141+
PENALTYSHOOT --> #PenaltyShootoutBehavior
142+
TIMEOUT --> #StandAndLook
143+
ELSE --> $SecondaryStateTeamDecider
144+
OUR --> #NormalBehavior // Nutzt immer normalBehaviour wenn wir die aktion ausführen, könnte man spezifischeres Verhalten definieren
145+
OTHER --> #Placing
146+
NORMAL --> #NormalBehavior
147+
OVERTIME --> #NormalBehavior
148+
139149
-->BodyBehavior
140150
$IsPenalized
141151
YES --> #DoNothing
@@ -149,23 +159,17 @@ $IsPenalized
149159
NO --> $DoOnce
150160
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:2
151161
DONE --> #PositioningReady
152-
SET --> $SecondaryStateDecider
153-
PENALTYSHOOT --> $SecondaryStateTeamDecider
154-
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
155-
OTHER --> $BallSeen
156-
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
157-
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
158-
ELSE --> #StandAndLook
162+
SET --> $WhistleDetected
163+
YES --> #PlayingBehavior
164+
NO --> $SecondaryStateDecider
165+
PENALTYSHOOT --> $SecondaryStateTeamDecider
166+
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
167+
OTHER --> $BallSeen
168+
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
169+
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
170+
ELSE --> #StandAndLook
159171
FINISHED --> $CurrentScore
160172
AHEAD --> @Stand + duration:0.5 + r:false, @PlaySound + file:fanfare.wav, @PlayAnimationCheering + r:false, @GetWalkready + r:false, @LookForward, @Stand
161173
ELSE --> #Init
162-
PLAYING --> $SecondaryStateDecider
163-
PENALTYSHOOT --> #PenaltyShootoutBehavior
164-
TIMEOUT --> #StandAndLook
165-
ELSE --> $SecondaryStateTeamDecider
166-
OUR --> #NormalBehavior //Nutzt immer normalBehaviour wenn wir die aktion ausführen, könnte man spezifischeres Verhalten definieren
167-
OTHER --> #Placing
168-
NORMAL --> #NormalBehavior
169-
OVERTIME --> #NormalBehavior
174+
PLAYING --> #PlayingBehavior
170175
STANDBY --> #StandAndLook
171-

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
@@ -11,6 +11,7 @@
1111
from rclpy.experimental.events_executor import EventsExecutor
1212
from rclpy.node import Node
1313
from soccer_vision_3d_msgs.msg import RobotArray
14+
from std_msgs.msg import Bool
1415

1516
from bitbots_body_behavior import behavior_dsd
1617
from bitbots_msgs.msg import RobotControlState, TeamData
@@ -75,6 +76,13 @@ def __init__(self, node: Node):
7576
qos_profile=1,
7677
callback_group=MutuallyExclusiveCallbackGroup(),
7778
)
79+
node.create_subscription(
80+
Bool,
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_lowlevel/bitbots_ros_control/include/bitbots_ros_control/bitfoot_hardware_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef BITBOTS_ROS_CONTROL_INCLUDE_BITBOTS_ROS_CONTROL_BITFOOT_HARDWARE_INTERFACE_H_
22
#define BITBOTS_ROS_CONTROL_INCLUDE_BITBOTS_ROS_CONTROL_BITFOOT_HARDWARE_INTERFACE_H_
33

4-
#include <dynamixel_driver.h>
4+
#include <dynamixel_workbench_toolbox/dynamixel_driver.h>
55

66
#include <bitbots_msgs/msg/foot_pressure.hpp>
77
#include <bitbots_ros_control/hardware_interface.hpp>

0 commit comments

Comments
 (0)