Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
7f03814
Add rl walking node
Flova Jun 29, 2025
872c55b
Use weaker PIDs
Flova Jul 4, 2025
56bbfbc
Fixes for real robot
Flova Jul 4, 2025
fa28e87
Sync package
Flova Jul 4, 2025
bea2bf0
Working state (hcm in the loop still fails due to increased delays)
Flova Aug 4, 2025
a4d9c29
added new wlaking model
sWintermoor Feb 8, 2026
ca6b18f
Resolve conflicts: accept deletions from origin/main
sWintermoor Feb 8, 2026
00f2925
Merge remote-tracking branch 'origin/main' into feature/bitbots_rl_walk
sWintermoor Feb 8, 2026
dd28ecb
pixi conf and transition to walk ready pos
sWintermoor Feb 8, 2026
431d1bd
modified walk model
sWintermoor Feb 8, 2026
8043366
adjustments to wolfgang_walk_ppo model
sWintermoor Feb 8, 2026
9677784
kicking model and config
sWintermoor Feb 21, 2026
976e0d9
implementing rl kick in behaviour
sWintermoor Feb 22, 2026
8bfd972
fixing action and capsule -> PoseStamped
sWintermoor Feb 22, 2026
ae88760
rl kick input
sWintermoor Feb 22, 2026
e9bbd94
changed dsd
sWintermoor Feb 22, 2026
2d1adf7
calculating target
sWintermoor Feb 22, 2026
8276efc
kicking in motion.launch
sWintermoor Feb 26, 2026
ad9a5c2
correct onnx model
sWintermoor Mar 8, 2026
31d8a83
combine walk and kick model into one
sWintermoor Mar 8, 2026
5829e6d
fixing bugs
sWintermoor Mar 8, 2026
65d64db
publish error?
sWintermoor Mar 8, 2026
5935ca6
change the launch rl topics
sWintermoor Mar 9, 2026
3c2afeb
creating a framework (not working)
sWintermoor Mar 10, 2026
c547090
improving framework (still not working)
sWintermoor Mar 10, 2026
251c08d
fix imports and handler
sWintermoor Mar 10, 2026
818ba4d
fix
sWintermoor Mar 10, 2026
f21b7bd
import fix
sWintermoor Mar 10, 2026
96560ea
more or less good framework (untested)
sWintermoor Mar 10, 2026
8e226e9
input and output name - automated
sWintermoor Mar 11, 2026
4e2c328
abstract handler class
sWintermoor Mar 11, 2026
c4f5003
bug fixes
sWintermoor Mar 11, 2026
027ac43
phase in child class
sWintermoor Mar 11, 2026
57b638d
fixes
sWintermoor Mar 11, 2026
84ee120
forward_kick integration
sWintermoor Mar 12, 2026
92d8848
Merge remote-tracking branch 'origin/main' into bitbots_rl_walk
sWintermoor Mar 12, 2026
fec0b39
pixi.lock change
sWintermoor Mar 12, 2026
631475f
Merge branch 'main' into bitbots_rl_walk
sWintermoor Mar 12, 2026
ff6a3ea
new pixi.lock
sWintermoor Mar 12, 2026
98e3e98
new policy
sWintermoor Mar 13, 2026
01149e2
fix
sWintermoor Mar 13, 2026
c2ee62a
new executor
sWintermoor Mar 13, 2026
e380a03
using confg method to avoid initialization deadlocks
sWintermoor Mar 13, 2026
3bc4e50
fix
sWintermoor Mar 13, 2026
03ae24c
following PEP 8
sWintermoor Mar 25, 2026
ae8b277
using central config file
sWintermoor Mar 25, 2026
d22dd9d
fix
sWintermoor Mar 25, 2026
341cb6a
extra loading function + fixes
sWintermoor Mar 25, 2026
15d41a2
replaced old bitbots_rl_motion with bitbots_rl_walk
sWintermoor Mar 25, 2026
eedce63
better function names and saving specifications in yaml
sWintermoor Mar 27, 2026
7fa2e90
no irritating config function
sWintermoor Mar 27, 2026
bbcb1f1
testable stated (PhaseObject + ReadMe)
sWintermoor Mar 28, 2026
a92aebc
kick node
sWintermoor Mar 28, 2026
b4789af
fixes
sWintermoor Mar 28, 2026
11f1da6
Merge remote-tracking branch 'origin/main' into feature/bitbots_rl_walk
sWintermoor Mar 28, 2026
bfb13b4
changed maintainer
sWintermoor Mar 28, 2026
f066501
fixing bugs
sWintermoor Mar 28, 2026
1a92e74
small bug fixes
sWintermoor Mar 28, 2026
e7da5e6
subscriber fix
sWintermoor Mar 28, 2026
5bba14b
refactoring (+ abstraction)
sWintermoor Mar 28, 2026
c1e6e7e
refactoring obs
sWintermoor Mar 28, 2026
fedd633
newest kick model
sWintermoor Mar 28, 2026
f847afa
fixes
sWintermoor Mar 28, 2026
d7e8818
multiple policy nodes
sWintermoor Mar 28, 2026
bf60258
debugged walk policy
sWintermoor Mar 28, 2026
139e8aa
only kick
sWintermoor Mar 28, 2026
73a4a99
delete unnecessary code
sWintermoor Mar 28, 2026
f1e9881
more precise warning message
sWintermoor Mar 30, 2026
cb30aeb
publisher fix
sWintermoor Mar 30, 2026
be9bf5a
debugging domain problem
sWintermoor Mar 30, 2026
e1bfaaf
refactoring ball handler
sWintermoor Mar 30, 2026
c039cb0
refactoring
sWintermoor Mar 30, 2026
1b05e34
bug fix
sWintermoor Mar 30, 2026
6640b4b
refactoring
sWintermoor Apr 1, 2026
4a937ac
fix phase
sWintermoor Apr 1, 2026
f44c21f
reset code to normal state
sWintermoor Apr 1, 2026
650c38b
fixed readme
sWintermoor Apr 1, 2026
db9759f
better publisher name for rl kick capsule
sWintermoor Apr 11, 2026
cea5668
todos removed
sWintermoor Apr 11, 2026
fea2b13
using one config file per policy model
sWintermoor Apr 11, 2026
293f5ac
removin boilerplate code - subscription code now in handlers
sWintermoor Apr 11, 2026
8004723
phase is optional
sWintermoor Apr 11, 2026
2e98274
add comment
sWintermoor Apr 11, 2026
0330ed4
remove deps
sWintermoor Apr 11, 2026
ac6f5b0
comments and car changes on old walking
sWintermoor Apr 11, 2026
6ebacba
fix config naming
sWintermoor Apr 11, 2026
73f9995
launch file for rl motion
sWintermoor Apr 11, 2026
36d0c92
using launch file instead py file
sWintermoor Apr 11, 2026
b0c7445
updare gitignore
sWintermoor Apr 11, 2026
525d3db
removed arg in rl_motion.launch
sWintermoor Apr 11, 2026
2cc44e6
fixed readme
sWintermoor Apr 11, 2026
914d6a1
added todo
sWintermoor Apr 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bitbots_docs_internal

# Neural Network Model Path
/src/bitbots_vision/models/
/src/bitbots_motion/bitbots_rl_motion/rl_walk_models/
/src/bitbots_motion/bitbots_rl_motion/models/

**/.*.
.idea/*
Expand Down
24 changes: 24 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from enum import Flag
from typing import Optional

from geometry_msgs.msg import PoseStamped
from rclpy.action import ActionClient
from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.duration import Duration
Expand Down Expand Up @@ -34,6 +35,7 @@ class WalkKickTargets(Flag):
RIGHT = True

walk_kick_pub: Publisher
rl_kick_pub: Publisher

def __init__(self, node, blackboard):
super().__init__(node, blackboard)
Expand All @@ -42,6 +44,7 @@ def __init__(self, node, blackboard):
"""
self.walk_kick_pub = self._node.create_publisher(Bool, "/kick", 1)
# self.connect_dynamic_kick() Do not connect if dynamic_kick is disabled
self.rl_kick_pub = self._node.create_publisher(PoseStamped, "/rl_command/kick_command", 1)

def walk_kick(self, target: WalkKickTargets) -> None:
"""
Expand Down Expand Up @@ -81,6 +84,13 @@ def dynamic_kick(self, goal: Kick.Goal) -> None:
self.last_goal = goal
self.last_goal_sent = self._node.get_clock().now()

def rl_kick(self, ball_pose: PoseStamped) -> None:
"""
Kick the ball using the RL kick
:param goal_pose: Pose to kick to
"""
self.rl_kick_pub.publish(ball_pose)

def __feedback_cb(self, feedback):
self.last_feedback: Kick.Feedback = feedback.feedback
self.last_feedback_received = self._node.get_clock().now()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from bitbots_blackboard.capsules.kick_capsule import KickCapsule
from bitbots_utils.transforms import quat_from_yaw
from dynamic_stack_decider.abstract_action_element import AbstractActionElement
from geometry_msgs.msg import PoseStamped

from bitbots_msgs.action import Kick

Expand Down Expand Up @@ -123,3 +124,33 @@ def perform(self, reevaluate=False):
self._goal_sent = True
else:
self.pop()


# TODO: Fix integration
class RLKick(AbstractKickAction):
def __init__(self, blackboard, dsd, parameters):
super().__init__(blackboard, dsd, parameters)

self.kick_length = self.blackboard.config["kick_cost_kick_length"]
self.angular_range = self.blackboard.config["kick_cost_angular_range"]
self.max_kick_angle = self.blackboard.config["max_kick_angle"]
self.num_kick_angles = self.blackboard.config["num_kick_angles"]
self.penalty_kick_angle = self.blackboard.config["penalty_kick_angle"]

def perform(self, reevaluate=False):
ball_pose = PoseStamped()
ball_pose.header.stamp = self.blackboard.node.get_clock().now().to_msg()
ball_pose.header.frame_id = self.blackboard.world_model.base_footprint_frame

ball_u, ball_v = self.blackboard.world_model.get_ball_position_uv()
ball_pose.pose.position.x = ball_u
ball_pose.pose.position.y = ball_v
ball_pose.pose.position.z = 0.0

ball_pose.pose.orientation.x = 0.0 # isn't used
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Currently no angle is set, but there are some parameters normally used by the angle estimation in the constructor.

ball_pose.pose.orientation.y = 0.0
ball_pose.pose.orientation.z = 0.0
ball_pose.pose.orientation.w = 1.0

self.blackboard.kick.rl_kick(ball_pose)
self.pop()
10 changes: 5 additions & 5 deletions src/bitbots_lowlevel/bitbots_ros_control/config/wolfgang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ wolfgang_hardware_interface:
servos:
# specifies which information should be read
read_position: true
read_velocity: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the velocities used for?

read_velocity: true
read_effort: false
read_pwm: false
read_volt_temp: true # this also corresponds for the error byte
Expand Down Expand Up @@ -61,7 +61,7 @@ wolfgang_hardware_interface:
Position_D_Gain: 0 #2800 # [/16] 0~16,383
Position_I_Gain: 0 #180000 # [/ 65,536] 0~16,383
#If robot starts to tremble, reduce Position_P_Gain
Position_P_Gain: 1200 #1100 # [/ 128] 0~16,383
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing these P-gain values? Can we still walk as usual with this?

Position_P_Gain: 300 #1100 # [/ 128] 0~16,383
Feedforward_2nd_Gain: 0 # [/4]
Feedforward_1st_Gain: 0 # [/4]
Profile_Acceleration: 0 # 0 for infinite
Expand Down Expand Up @@ -89,7 +89,7 @@ wolfgang_hardware_interface:
Position_D_Gain: 0 #2800 # [/16] 0~16,383
Position_I_Gain: 0 #180000 # [/ 65,536] 0~16,383
#If robot starts to tremble, reduce Position_P_Gain
Position_P_Gain: 800 #1100 # [/ 128] 0~16,383
Position_P_Gain: 1100 #1100 # [/ 128] 0~16,383
Feedforward_2nd_Gain: 0 # [/4]
Feedforward_1st_Gain: 0 # [/4]
Profile_Acceleration: 0 # 0 for infinite
Expand Down Expand Up @@ -117,7 +117,7 @@ wolfgang_hardware_interface:
Position_D_Gain: 0 #2800 # [/16] 0~16,383
Position_I_Gain: 0 #180000 # [/ 65,536] 0~16,383
#If robot starts to tremble, reduce Position_P_Gain
Position_P_Gain: 4000 #1100 # [/ 128] 0~16,383
Position_P_Gain: 600 #1100 # [/ 128] 0~16,383
Feedforward_2nd_Gain: 0 # [/4]
Feedforward_1st_Gain: 0 # [/4]
Profile_Acceleration: 0 # 0 for infinite
Expand Down Expand Up @@ -145,7 +145,7 @@ wolfgang_hardware_interface:
Position_D_Gain: 0 #2800 # [/16] 0~16,383
Position_I_Gain: 0 #180000 # [/ 65,536] 0~16,383
#If robot starts to tremble, reduce Position_P_Gain
Position_P_Gain: 500 #1100 # [/ 128] 0~16,383
Position_P_Gain: 100 #1100 # [/ 128] 0~16,383
Feedforward_2nd_Gain: 0 # [/4]
Feedforward_1st_Gain: 0 # [/4]
Profile_Acceleration: 0 # 0 for infinite
Expand Down
11 changes: 9 additions & 2 deletions src/bitbots_misc/bitbots_bringup/launch/motion.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<launch>
<arg name="sim" default="false"/>
<arg name="viz" default="false"/>
<arg name="walking" default="true" description="start the walking" />
<arg name="walking" default="false" description="start the walking" /> <!--should be removed-->
<arg name="rl_policies" default="true" description="start the policies" />
<arg name="torqueless_mode" default="false" description="start without torque, for example for testing the falling detection"/>
<arg name="tts" default="true" description="Whether to speak" />

Expand Down Expand Up @@ -38,7 +39,7 @@
<arg name="sim" value="$(var sim)" />
</include>

<!-- launch the walking -->
<!-- launch the old walking - exists for debug purpose-->
<group if="$(var walking)">
<include file="$(find-pkg-share bitbots_quintic_walk)/launch/quintic_walk.launch">
<arg name="sim" value="$(var sim)"/>
Expand All @@ -58,6 +59,12 @@
</include>
-->


<!--launch rl policies -->
<include file="$(find-pkg-share bitbots_rl_motion)/launch/rl_motion.launch">
<arg name="sim" value="$(var sim)"/>
</include>

<!-- launch dynup -->
<include file="$(find-pkg-share bitbots_dynup)/launch/dynup.launch">
<arg name="sim" value="$(var sim)"/>
Expand Down
1 change: 1 addition & 0 deletions src/bitbots_misc/bitbots_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<exec_depend>bitbots_localization</exec_depend>
<exec_depend>bitbots_odometry</exec_depend>
<exec_depend>bitbots_quintic_walk</exec_depend>
<exec_depend>bitbots_rl_motion</exec_depend>
<exec_depend>bitbots_robot_description</exec_depend>
<exec_depend>bitbots_ros_control</exec_depend>
<exec_depend>bitbots_utils</exec_depend>
Expand Down
10 changes: 5 additions & 5 deletions src/bitbots_motion/bitbots_dynup/config/dynup_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ bitbots_dynup:
trunk_height:
type: double
description: "End pose trunk height. Depends on walkready of walking."
default_value: 0.38
default_value: 0.372
validation:
bounds<>: [0.0, 1.0]
trunk_pitch:
type: double
description: "End pose trunk pitch. Depends on walkready of walking."
default_value: 0.2
default_value: 11.459
validation:
bounds<>: [0.0, 1.0]
bounds<>: [-40.0, 40.0]
trunk_x_final:
type: double
description: "End pose position of the trunk in x direction. Depends on walkready of walking."
default_value: 0.001
default_value: -0.0839
validation:
bounds<>: [0.0, 1.0]
bounds<>: [-0.2, 0.2]
arm_side_offset_back:
type: double
description: "End pose arm side offset back. Depends on walkready of walking."
Expand Down
16 changes: 0 additions & 16 deletions src/bitbots_motion/bitbots_rl_motion/CMakeLists.txt

This file was deleted.

27 changes: 27 additions & 0 deletions src/bitbots_motion/bitbots_rl_motion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## General

The package contains a framework which is a capsule for the application of policies on a robot.

## Framework structure

The code is divided in five sections: Configs, Handlers, Nodes, Launch and rest.

The Nodes-folder contains all relevant ROS-Nodes regarding policy models. These nodes are responsible for starting the policies correctly, feeding them with correct data and publishing their outputs correctly.
The name of the node describes for which kind of policy it is suitable.
The RL Node is a special case. All other nodes are kids of the RL Node. It centralizes the execution loop and minimizes boiler plate code.

The Handlers-folder contains all handlers. A handler is a specific type of object which is responsible for processing external data such that they are comprehensible for the policy models. All handlers are kids of the Handler class.

The Configs-folder contains all robot/policy specific configurations. Files in the Configs-folder should be in .yaml-format. They also contain the paths to the onnx-policy models.

The Launch-folder contains a launch file which starts all relevant policy nodes.

phase.py and previous_action.py are two files, which do not fall in any of the aforementioned categories.
phase.py defines a PhaseObject, which is responsible for the phase management. previous_action.py defindes a PreviousAction object, which is responsible for saving and provide the previous action.
Both files are located in the bitbots_rl_motion folder.

## Execution

For proper starting you need a policy model and a config file. The config file should have the same structure as the wolfgang_dribbling_model_config.yaml file.
Furthermore, you have to create or adjust a node file to your needs. walk_node.py can be used for orientation. If chages are conducted on the RL_Node class, it should be announced.
Finally, you define which nodes and policies you wanna use in the launch file.
Empty file.
37 changes: 37 additions & 0 deletions src/bitbots_motion/bitbots_rl_motion/bitbots_rl_motion/phase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import numpy as np
from rclpy.node import Node

# Please pay attention to the code in rl_node.py if you wanna change here sth.


class PhaseObject(Node):
_phase: np.ndarray = np.array([0.0, np.pi], dtype=np.float32)
_phase_dt: float

def __init__(self, config):
if self.config["phase"]:
self._control_dt = config["phase"]["control_dt"]
self._gait_frequency = config["phase"]["gait_frequency"]
self._phase_dt = 2 * np.pi * self._gait_frequency * self._control_dt
else:
self._control_dt = None
self._gait_frequency = None
self._phase_dt = None
self.get_logger().warning("No phase was found! Using policy without phase!")

self._obs_phase = None

def set_phase(self, new_phase):
self._phase = new_phase

def set_obs_phase(self, new_obs_phase):
self._obs_phase = new_obs_phase

def get_phase(self):
return self._phase

def get_phase_dt(self):
return self._phase_dt

def get_obs_phase(self):
return self._obs_phase
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np


class PreviousActionObject:
def __init__(self, config):
self._previous_action: np.ndarray = np.zeros(
len(config["joints"]["ordered_relevant_joint_names"]), dtype=np.float32
)

def set_previous_action(self, new_previous_action):
self._phase = new_previous_action

def get_previous_action(self):
return self._previous_action
3 changes: 0 additions & 3 deletions src/bitbots_motion/bitbots_rl_motion/config/rl_walk_sim.yaml

This file was deleted.

Loading
Loading