Skip to content

Commit 261324c

Browse files
author
cl03
committed
Merge branch 'feature/better_ball_search' of github.com:bit-bots/bitbots_main into feature/better_ball_search
2 parents 01a9945 + 4428513 commit 261324c

File tree

17 files changed

+103
-50
lines changed

17 files changed

+103
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def perform(self, reevaluate=False):
7676

7777
class GoToAbsolutePositionFieldFraction(GoToAbsolutePosition):
7878
def __init__(self, blackboard, dsd, parameters):
79-
"""Go to the own goal"""
79+
"""Go to an absolute position of the field, specified by the fraction of the field size"""
8080
super().__init__(blackboard, dsd, parameters)
8181
point = float(parameters.get("x", 0)), float(parameters.get("y", 0)), float(parameters.get("t", 0))
8282
self.point = (

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ $IsPenalized
158158
READY --> $AnyGoalScoreRecently + time:50
159159
YES --> #PositioningReady
160160
NO --> $DoOnce
161-
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:1, @GetWalkready + r:false
161+
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:2
162162
DONE --> #PositioningReady
163163
SET --> $SecondaryStateDecider
164164
PENALTYSHOOT --> $SecondaryStateTeamDecider

bitbots_lowlevel/bitbots_ros_control/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ find_package(controller_manager REQUIRED)
1616
find_package(diagnostic_msgs REQUIRED)
1717
find_package(dynamixel_workbench_toolbox REQUIRED)
1818
find_package(hardware_interface REQUIRED)
19+
find_package(moveit_core REQUIRED)
20+
find_package(moveit_ros_planning REQUIRED)
1921
find_package(pluginlib REQUIRED)
2022
find_package(rclcpp REQUIRED)
2123
find_package(realtime_tools REQUIRED)
@@ -60,6 +62,8 @@ ament_target_dependencies(
6062
diagnostic_msgs
6163
dynamixel_workbench_toolbox
6264
hardware_interface
65+
moveit_core
66+
moveit_ros_planning
6367
pluginlib
6468
rclcpp
6569
realtime_tools

bitbots_lowlevel/bitbots_ros_control/include/bitbots_ros_control/dynamixel_servo_hardware_interface.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class DynamixelServoHardwareInterface : public bitbots_ros_control::HardwareInte
7070
unsigned int joint_count_;
7171

7272
std::vector<std::string> joint_names_;
73+
std::vector<double> lower_joint_limits_;
74+
std::vector<double> upper_joint_limits_;
7375

7476
std::vector<double> goal_position_;
7577
std::vector<double> goal_effort_;

bitbots_lowlevel/bitbots_ros_control/src/dynamixel_servo_hardware_interface.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#include <moveit/robot_model/robot_model.h>
2+
#include <moveit/robot_model_loader/robot_model_loader.h>
3+
14
#include <bitbots_ros_control/dynamixel_servo_hardware_interface.hpp>
25
#include <bitbots_ros_control/utils.hpp>
36
#include <utility>
@@ -63,6 +66,18 @@ bool DynamixelServoHardwareInterface::init() {
6366
joint_map_[joint_names_[i]] = i;
6467
}
6568

69+
// read lower and upper limits
70+
robot_model_loader::RobotModelLoader rml(nh_, "robot_description", false);
71+
moveit::core::RobotModelPtr model = rml.getModel();
72+
lower_joint_limits_.resize(joint_count_);
73+
upper_joint_limits_.resize(joint_count_);
74+
for (const std::string &joint_name : joint_names_) {
75+
moveit::core::JointModel *jm = model->getJointModel(joint_name);
76+
// we use getVariableBounds()[0] because there is only a single variable for all of our joints
77+
lower_joint_limits_[joint_map_[joint_name]] = jm->getVariableBounds()[0].min_position_;
78+
upper_joint_limits_[joint_map_[joint_name]] = jm->getVariableBounds()[0].max_position_;
79+
}
80+
6681
std::string control_mode;
6782
control_mode = nh_->get_parameter("servos.control_mode").as_string();
6883
RCLCPP_INFO(nh_->get_logger(), "Control mode: %s", control_mode.c_str());
@@ -88,10 +103,19 @@ void DynamixelServoHardwareInterface::commandCb(const bitbots_msgs::msg::JointCo
88103
RCLCPP_ERROR(nh_->get_logger(), "Dynamixel Controller got command with inconsistent array lengths.");
89104
return;
90105
}
91-
// todo improve performance
92106
for (unsigned int i = 0; i < command_msg.joint_names.size(); i++) {
93107
int joint_id = joint_map_[command_msg.joint_names[i]];
94-
goal_position_[joint_id] = command_msg.positions[i];
108+
if (command_msg.positions[i] > upper_joint_limits_[joint_id] ||
109+
command_msg.positions[i] < lower_joint_limits_[joint_id]) {
110+
RCLCPP_WARN_STREAM(nh_->get_logger(), "Invalid position for " << command_msg.joint_names[i] << ": "
111+
<< command_msg.positions[i] << " not in ("
112+
<< lower_joint_limits_[joint_id] << ", "
113+
<< upper_joint_limits_[joint_id] << ")");
114+
goal_position_[joint_id] =
115+
std::clamp(command_msg.positions[i], lower_joint_limits_[joint_id], upper_joint_limits_[joint_id]);
116+
} else {
117+
goal_position_[joint_id] = command_msg.positions[i];
118+
}
95119
goal_velocity_[joint_id] = command_msg.velocities[i];
96120
goal_acceleration_[joint_id] = command_msg.accelerations[i];
97121
goal_effort_[joint_id] = command_msg.max_currents[i];

bitbots_misc/bitbots_docs/docs/manual/tutorials/extrinsic_calibration.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Setup
1414
1. Start the visualization launch-file including the necessary motion and vision nodes.
1515

1616
.. code-block:: bash
17-
ros2 launch bitbots_extrinsic_calibration viz_extrinsic_calibration.launch
17+
18+
ros2 launch bitbots_extrinsic_calibration viz_extrinsic_calibration.launch
1819
1920
2. In Dynamic Reconfigure open the parameters (left panel) for the nodes: :code:`bitbots_extrinsic_imu_calibration` and :code:`bitbots_extrinsic_camera_calibration`.
2021

@@ -26,6 +27,10 @@ Do the calibration
2627

2728
2. Open rqt and navigate to **Plugins** > **Configurations** > **Dynamic Reconfigure** where you can configure the parameters.
2829

30+
3. Place the robot outside the field exactly in front of the middle line.
31+
32+
4. Use the :code:`2D Pose Estimate` button in RViz to place the virtual robot in the corresponding pose.
33+
2934
.. note::
3035
If you change the calibration first change all parameters to :code:`0.0`.
3136
Then start with the adjustment of the IMU parameters.

bitbots_misc/bitbots_extrinsic_calibration/config/jack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/bitbots_extrinsic_camera_calibration:
22
ros__parameters:
3-
offset_x: -0.025
3+
offset_x: -0.02
44
offset_y: 0.0
55
offset_z: 0.0
66

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/bitbots_extrinsic_camera_calibration:
22
ros__parameters:
3-
offset_x: -0.07
4-
offset_y: 0.0
3+
offset_x: -0.06
4+
offset_y: 0.01
55
offset_z: 0.0
66

77
/bitbots_extrinsic_imu_calibration:
88
ros__parameters:
9-
offset_x: -0.0
10-
offset_y: 0.01
9+
offset_x: 0.0
10+
offset_y: 0.017
1111
offset_z: 0.0

bitbots_motion/bitbots_quintic_walk/config/robots/jack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ walking:
44
ros__parameters:
55
engine:
66
trunk_x_offset: 0.0
7+
trunk_y_offset: -0.01
8+
79
node:
810
x_bias: -0.005
911
y_bias: -0.008

bitbots_motion/bitbots_quintic_walk/config/walking_wolfgang_robot.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ walking:
77
foot_apex_phase: 0.5
88
foot_apex_pitch: 0.0
99
foot_distance: 0.2
10-
foot_overshoot_phase: 0.67
11-
foot_overshoot_ratio: 0.1
10+
foot_overshoot_phase: 0.92
11+
foot_overshoot_ratio: 0.0
1212
foot_put_down_phase: 1.0
1313
foot_put_down_z_offset: 0.0
1414
foot_rise: 0.04
@@ -26,7 +26,7 @@ walking:
2626
trunk_pitch_p_coef_forward: 0.0
2727
trunk_pitch_p_coef_turn: 0.0
2828
trunk_swing: 0.25
29-
trunk_x_offset: -0.02
29+
trunk_x_offset: -0.01
3030
trunk_x_offset_p_coef_forward: 0.1
3131
trunk_x_offset_p_coef_turn: 0.0
3232
trunk_y_offset: 0.0
@@ -74,11 +74,11 @@ walking:
7474
trunk_pid:
7575
pitch:
7676
antiwindup: false
77-
d: 0.0
77+
d: 0.004
7878
i: 0.0
7979
i_clamp_max: 0.0
8080
i_clamp_min: 0.0
81-
p: 0.0
81+
p: 0.0035
8282
roll:
8383
antiwindup: false
8484
d: 0.0

bitbots_motion/bitbots_quintic_walk/src/walk_stabilizer.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void WalkStabilizer::reset() {
1515
pid_trunk_fused_roll_.reset();
1616
}
1717

18-
WalkResponse WalkStabilizer::stabilize(const WalkResponse &response, const rclcpp::Duration &dt) {
18+
WalkResponse WalkStabilizer::stabilize(const WalkResponse& response, const rclcpp::Duration& dt) {
1919
// compute orientation with PID control
2020
double goal_pitch, goal_roll, goal_yaw;
2121
tf2::Matrix3x3(response.support_foot_to_trunk.getRotation()).getRPY(goal_roll, goal_pitch, goal_yaw);
@@ -33,14 +33,15 @@ WalkResponse WalkStabilizer::stabilize(const WalkResponse &response, const rclcp
3333
double fused_pitch_correction =
3434
pid_trunk_fused_pitch_.computeCommand(goal_fused.fusedPitch - response.current_fused_pitch, dt);
3535

36-
tf2::Quaternion corrected_orientation;
37-
goal_fused.fusedRoll += fused_roll_correction;
38-
goal_fused.fusedPitch += fused_pitch_correction;
39-
Eigen::Quaterniond goal_orientation_eigen_corrected = rot_conv::QuatFromFused(goal_fused);
40-
tf2::convert(goal_orientation_eigen_corrected, corrected_orientation);
36+
// Change trunk x offset (in the trunks frame of reference) based on the PID controllers
37+
WalkResponse stabilized_response{response};
4138

42-
WalkResponse stabilized_response = response;
43-
stabilized_response.support_foot_to_trunk.setRotation(corrected_orientation);
39+
tf2::Transform trunk_offset;
40+
trunk_offset.setOrigin(tf2::Vector3(fused_pitch_correction, fused_roll_correction, 0.0));
41+
trunk_offset.setRotation(tf2::Quaternion::getIdentity());
42+
43+
// apply the trunk offset to the trunk pose
44+
stabilized_response.support_foot_to_trunk = trunk_offset * response.support_foot_to_trunk;
4445

4546
return stabilized_response;
4647
}

bitbots_navigation/bitbots_path_planning/config/path_planning_parameters.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ bitbots_path_planning:
8585
bounds<>: [0.0, 1.0]
8686
max_vel_x:
8787
type: double
88-
default_value: 0.07
88+
default_value: 0.12
8989
description: 'Maximum velocity we want to reach in different directions (base_footprint coordinate system)'
9090
validation:
9191
bounds<>: [0.0, 1.0]
9292
min_vel_x:
9393
type: double
94-
default_value: -0.05
94+
default_value: -0.06
9595
description: 'Minimum velocity we want to reach in different directions (base_footprint coordinate system)'
9696
validation:
9797
bounds<>: [-1.0, 0.0]
9898
max_vel_y:
9999
type: double
100-
default_value: 0.06
100+
default_value: 0.07
101101
description: 'Maximum velocity we want to reach in different directions (base_footprint coordinate system)'
102102
validation:
103103
bounds<>: [0.0, 1.0]

bitbots_navigation/bitbots_path_planning/test/__snapshots__/test_controller.ambr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# name: test_default_setup
33
dict({
44
'carrot_distance': 4,
5-
'max_rotation_vel': 0.4,
6-
'max_vel_x': 0.12,
7-
'max_vel_y': 0.05,
5+
'max_rotation_vel': 0.3,
6+
'max_vel_x': 0.07,
7+
'max_vel_y': 0.06,
88
'min_vel_x': -0.05,
99
'orient_to_goal_distance': 1.0,
1010
'rotation_i_factor': 0.0,
@@ -14,5 +14,5 @@
1414
})
1515
# ---
1616
# name: test_step_cmd_vel_smoothing
17-
'geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.056147836300549855, y=0.03337183236993486, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.20666164469042259))'
17+
'geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.04351964304912127, y=0.030817565809235677, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.19312811636676133))'
1818
# ---

bitbots_team_communication/bitbots_team_communication/config/team_communication_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ team_comm:
22
ros__parameters:
33
# UDP broadcast address is the highest IP in the subnet e.g. 172.20.255.255
44
# Sets local mode if set to loopback (127.0.0.1)
5-
target_ip: 10.87.255.255
5+
target_ip: 192.168.255.255
66

77
# Only used in non local mode with specific target_ip
88
target_port: 3737

bitbots_wolfgang/wolfgang_description/urdf/robot.urdf

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,15 @@
724724
<axis xyz="0.0 0.0 1.0"/>
725725
<parent link="r_upper_arm"/>
726726
<child link="r_lower_arm"/>
727-
<limit effort="7.3" lower="-1.0472" upper="1.5708" velocity="8.17"/>
727+
<limit effort="7.3" lower="-0.78" upper="1.5708" velocity="8.17"/>
728728
<dynamics damping="0.65" friction="1.73"/>
729729
</joint>
730730
<joint name="RShoulderRoll" type="revolute">
731731
<origin rpy="1.5708 8.32338e-16 -1.5708" xyz="-0.01695 0.042 0.0"/>
732732
<axis xyz="-0.0 -0.0 -1.0"/>
733733
<parent link="r_shoulder"/>
734734
<child link="r_upper_arm"/>
735-
<limit effort="7.3" lower="0.0" upper="3.14159" velocity="8.17"/>
735+
<limit effort="7.3" lower="-0.12" upper="3.1416" velocity="8.17"/>
736736
<dynamics damping="0.65" friction="1.73"/>
737737
</joint>
738738
<joint name="RShoulderPitch" type="revolute">
@@ -1079,15 +1079,15 @@
10791079
<axis xyz="0.0 0.0 1.0"/>
10801080
<parent link="l_upper_arm"/>
10811081
<child link="l_lower_arm"/>
1082-
<limit effort="7.3" lower="-1.5708" upper="1.0472" velocity="8.17"/>
1082+
<limit effort="7.3" lower="-1.5708" upper="0.78" velocity="8.17"/>
10831083
<dynamics damping="0.65" friction="1.73"/>
10841084
</joint>
10851085
<joint name="LShoulderRoll" type="revolute">
10861086
<origin rpy="-1.5708 -5.19331e-15 1.5708" xyz="-0.01695 0.042 -2.77556e-17"/>
10871087
<axis xyz="-0.0 -0.0 -1.0"/>
10881088
<parent link="l_shoulder"/>
10891089
<child link="l_upper_arm"/>
1090-
<limit effort="7.3" lower="-3.14159" upper="0.0" velocity="8.17"/>
1090+
<limit effort="7.3" lower="-3.1416" upper="0.12" velocity="8.17"/>
10911091
<dynamics damping="0.65" friction="1.73"/>
10921092
</joint>
10931093
<joint name="LShoulderPitch" type="revolute">
@@ -2204,7 +2204,7 @@
22042204
<axis xyz="0.0 -1.0 0.0"/>
22052205
<parent link="r_ankle"/>
22062206
<child link="r_foot"/>
2207-
<limit effort="10" lower="-0.63" upper="1.58" velocity="5.76"/>
2207+
<limit effort="10" lower="-1.4" upper="1.58" velocity="5.76"/>
22082208
<dynamics damping="1.23" friction="2.55"/>
22092209
</joint>
22102210
<joint name="RAnklePitch" type="revolute">
@@ -2220,23 +2220,23 @@
22202220
<axis xyz="-0.0 -1.0 -0.0"/>
22212221
<parent link="r_upper_leg"/>
22222222
<child link="r_lower_leg"/>
2223-
<limit effort="12.9" lower="-2.88" upper="0.0" velocity="3.87"/>
2223+
<limit effort="12.9" lower="-2.8" upper="0.2" velocity="3.87"/>
22242224
<dynamics damping="2.92" friction="1.49"/>
22252225
</joint>
22262226
<joint name="RHipPitch" type="revolute">
22272227
<origin rpy="-1.5708 1.5708 0.0" xyz="-0.0265 -9.71445e-17 -0.0691"/>
22282228
<axis xyz="-0.0 1.0 -0.0"/>
22292229
<parent link="r_hip_2"/>
22302230
<child link="r_upper_leg"/>
2231-
<limit effort="10" lower="-2.246" upper="0.9" velocity="5.76"/>
2231+
<limit effort="10" lower="-2.77" upper="0.79" velocity="5.76"/>
22322232
<dynamics damping="1.23" friction="2.55"/>
22332233
</joint>
22342234
<joint name="RHipRoll" type="revolute">
22352235
<origin rpy="-3.14159 1.5708 0.0" xyz="-0.046 0.0414 6.93889e-18"/>
22362236
<axis xyz="-0.0 -0.0 -1.0"/>
22372237
<parent link="r_hip_1"/>
22382238
<child link="r_hip_2"/>
2239-
<limit effort="10" lower="-1.769" upper="0.871" velocity="5.76"/>
2239+
<limit effort="10" lower="-1.9" upper="1.6" velocity="5.76"/>
22402240
<dynamics damping="1.23" friction="2.55"/>
22412241
</joint>
22422242
<joint name="RHipYaw" type="revolute">
@@ -3353,7 +3353,7 @@
33533353
<axis xyz="-0.0 -1.0 -0.0"/>
33543354
<parent link="l_ankle"/>
33553355
<child link="l_foot"/>
3356-
<limit effort="10" lower="-1.58" upper="0.63" velocity="5.76"/>
3356+
<limit effort="10" lower="-1.58" upper="1.4" velocity="5.76"/>
33573357
<dynamics damping="1.23" friction="2.55"/>
33583358
</joint>
33593359
<joint name="LAnklePitch" type="revolute">
@@ -3369,23 +3369,23 @@
33693369
<axis xyz="-0.0 1.0 -0.0"/>
33703370
<parent link="l_upper_leg"/>
33713371
<child link="l_lower_leg"/>
3372-
<limit effort="12.9" lower="0" upper="2.88" velocity="3.87"/>
3372+
<limit effort="12.9" lower="-0.2" upper="2.8" velocity="3.87"/>
33733373
<dynamics damping="2.92" friction="1.49"/>
33743374
</joint>
33753375
<joint name="LHipPitch" type="revolute">
33763376
<origin rpy="2.67116e-16 -1.5708 0.0" xyz="0.026 6.93889e-18 -0.0691"/>
33773377
<axis xyz="7.95491e-17 -3.00167e-16 -1.0"/>
33783378
<parent link="l_hip_2"/>
33793379
<child link="l_upper_leg"/>
3380-
<limit effort="10" lower="-0.9" upper="2.246" velocity="5.76"/>
3380+
<limit effort="10" lower="-0.79" upper="2.77" velocity="5.76"/>
33813381
<dynamics damping="1.23" friction="2.55"/>
33823382
</joint>
33833383
<joint name="LHipRoll" type="revolute">
33843384
<origin rpy="3.14159 1.5708 0.0" xyz="-0.046 0.0414 6.93889e-18"/>
33853385
<axis xyz="-0.0 -0.0 -1.0"/>
33863386
<parent link="l_hip_1"/>
33873387
<child link="l_hip_2"/>
3388-
<limit effort="10" lower="-0.871" upper="1.769" velocity="5.76"/>
3388+
<limit effort="10" lower="-1.6" upper="1.9" velocity="5.76"/>
33893389
<dynamics damping="1.23" friction="2.55"/>
33903390
</joint>
33913391
<joint name="LHipYaw" type="revolute">
@@ -3622,7 +3622,7 @@
36223622
<axis xyz="-0.0 -0.0 1.0"/>
36233623
<parent link="neck"/>
36243624
<child link="head"/>
3625-
<limit effort="7.3" lower="-1.5708" upper="1.0472" velocity="8.17"/>
3625+
<limit effort="7.3" lower="-1.923" upper="1.24" velocity="8.17"/>
36263626
<dynamics damping="0.65" friction="1.73"/>
36273627
</joint>
36283628
<joint name="HeadPan" type="revolute">

requirements/dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ colorama # Colorful terminal formatting
44
exhale # Necessary for rst rendering
55
fabric # Manages SSH sessions for the deploy tool
66
GitPython # Used by the deploy tool to check current state of the git repository
7+
invoke # Necessary for paramiko
78
paramiko # Necessary for fabric
89
pre-commit # Installs and runs pre-commit hooks for git
10+
pytest-mock # Mocking for pytest
911
rich # Rich terminal output
1012
ruff # Python linting
1113
syrupy # Python snapshot testing
12-
pytest-mock # Mocking for pytest

0 commit comments

Comments
 (0)