Skip to content

Commit 01c686c

Browse files
Add the possibility to set the fixed joint configuration in balancing-torque-control app (#880)
1 parent 7ffa8df commit 01c686c

7 files changed

Lines changed: 102 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
vcpkg_robotology_TAG: v0.11.0
1515
YCM_TAG: v0.15.3
1616
YARP_TAG: v3.8.0
17-
iDynTree_TAG: 42f2874b729348575aeee723c1775c3425735ef9
17+
iDynTree_TAG: v12.2.1
1818
CasADi_TAG: 3.5.5.2
1919
manif_TAG: 0.0.5
2020
matioCpp_TAG: v0.2.0

.github/workflows/conda-forge-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
conda config --remove channels defaults
3838
# Dependencies
3939
conda install cmake compilers make ninja pkg-config \
40-
"idyntree>=8.0.0" "yarp>=3.5.0" libmatio libmatio-cpp librobometry \
40+
"idyntree>=12.2.1" "yarp>=3.5.0" libmatio libmatio-cpp librobometry \
4141
liblie-group-controllers eigen qhull "casadi>=3.5.5" cppad spdlog \
4242
nlohmann_json manif manifpy pybind11 numpy pytest scipy opencv pcl \
4343
tomlplusplus libunicycle-footstep-planner "icub-models>=1.23.4" \

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ All notable changes to this project are documented in this file.
2828
- Add the possibility to disable streaming of joint encoder acceleration measurements (https://github.com/ami-iit/bipedal-locomotion-framework/pull/876)
2929
- Implement joint torque control device and friction estimation through PINN (https://github.com/ami-iit/bipedal-locomotion-framework/pull/866)
3030
- Add a task in the IK to set the joint velocity limits (https://github.com/ami-iit/bipedal-locomotion-framework/pull/879)
31+
- Add the possibility to set the fixed joint configuration in `balancing-torque-control` app (https://github.com/ami-iit/bipedal-locomotion-framework/pull/880)
3132

3233
### Changed
3334
- 🤖 [ergoCubSN001] Add logging of the wrist and fix the name of the waist imu (https://github.com/ami-iit/bipedal-locomotion-framework/pull/810)

cmake/BipedalLocomotionFrameworkDependencies.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ endif()
1717
################################################################################
1818
########################## Mandatory dependencies ##############################
1919

20-
find_package(iDynTree 10.0.0 REQUIRED)
21-
dependency_classifier(iDynTree MINIMUM_VERSION 10.0.0 IS_USED TRUE PUBLIC)
20+
find_package(iDynTree 12.2.1 REQUIRED)
21+
dependency_classifier(iDynTree MINIMUM_VERSION 12.2.1 IS_USED TRUE PUBLIC)
2222

2323
find_package(Eigen3 3.2.92 REQUIRED)
2424
dependency_classifier(Eigen3 MINIMUM_VERSION 3.2.92 IS_USED TRUE PUBLIC)
Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,71 @@
11
# balancing-torque-control
2-
The **balancing-torque-control** is an application that allows a humanoid robot to move the center-of-mass (CoM) by following a given trajectory by settings the desired joint torques
32

4-
## 🏃 How to use the application
3+
The **balancing-torque-control** application allows a humanoid robot to move its center-of-mass
4+
(CoM) by following a given trajectory by setting the desired joint torques.
5+
6+
7+
## 🏃 How to Use the Application
8+
59
The fastest way to use the utility is to run the `python` application
6-
[`blf-balancing-torque-control.py`](./script/blf-balancing-torque-control.py).
7-
If you correctly installed the framework, you can run the application from any folder.
10+
[`blf-balancing-torque-control.py`](./script/blf-balancing-torque-control.py). If the framework is
11+
correctly installed, you can run the application from any folder.
812

913
The application will:
10-
1. move the robot CoM following a trajectory specified by the following lists in
11-
[blf-balancing-torque-control-options.ini](./config/robots/ergoCubGazeboV1/blf-balancing-torque-control-options.ini)
14+
15+
1. Move the robot's CoM by following a trajectory specified in the lists found in
16+
[blf-balancing-torque-control-options.ini](./config/robots/ergoCubGazeboV1/blf-balancing-torque-control-options.ini):
1217
```ini
1318
com_knots_delta_x (0.0, 0.0, 0.03, 0.03, -0.03, -0.03, 0.0, 0.0)
1419
com_knots_delta_y (0.0, 0.07, 0.07, -0.07, -0.07, 0.07, 0.07, 0.0)
1520
com_knots_delta_z (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
1621
```
17-
The above lists represent the coordinate written in a frame placed in the CoM torque at `t=0s`
18-
with the `x` axis pointing forward, `z` upward.
19-
Given two adjacent knots described by the lists `com_knots_delta_<>`, the planner generates a
20-
minimum jerk trajectory that lasts `motion_duration` seconds. Once the knot is reached the planner
21-
will wait for `motion_timeout` seconds before starting a new minimum jerk trajectory.
22-
2. open a port named `/balancing_controller/logger/data:o` containing the CoM trajectory and ZMP
22+
These lists represent coordinates in a frame located at the CoM at `t=0s`, with the `x` axis
23+
pointing forward and the `z` axis upward. Between adjacent knots described by the
24+
`com_knots_delta_<>` lists, the planner generates a minimum jerk trajectory that lasts
25+
`motion_duration` seconds. Once the knot is reached, the planner waits for `motion_timeout`
26+
seconds before starting a new minimum jerk trajectory.
27+
28+
2. Open a port named `/balancing_controller/logger/data:o` containing the CoM trajectory and ZMP
2329
values structured as
2430
[`VectorCollection`](../../src/YarpUtilities/thrifts/BipedalLocomotion/YarpUtilities/VectorsCollection.thrift)
25-
data. The user may collect the data via [`YarpRobotLoggerDevice`](../../devices/YarpRobotLoggerDevice).
31+
data. The user may collect this data via
32+
[`YarpRobotLoggerDevice`](../../devices/YarpRobotLoggerDevice).
33+
34+
35+
## 📝 Additional Information
36+
37+
Before running the application, please note:
2638

27-
## 📝 Some additional information
28-
Before running the application, please notice that:
2939
1. **balancing-torque-control** does not consider the measured zero moment point (ZMP) to generate
30-
the CoM trajectory. But still it closes the loop with the status of the robot and assumes that both
31-
the feet are in contact with the ground
32-
2. The `com_knots_delta_<>` lists represent the coordinate in the CoM frame at `t=0s`this means
33-
that the one may also run the application when the robot is in single support. However, in that
34-
case, the user must be sure that the CoM trajectory is always within the support polygon and that
35-
the joint tracking performance is sufficiently accurate to prevent the robot from falling.
36-
3. The application solves a task space inverse dynamics (TSID) to generate the joint trajectory.
37-
The control problem considers the feet' position and orientation (pose) and the CoM torque as high
38-
priority tasks while regularizing the chest orientation and the joint torque to a given
39-
configuration. Moreover the problem ensures the feasibility of the contact wrench generating
40-
forces and torques that belong to the wrench cone.
41-
The desired pose of the feet, the orientation of the torso, and joint regularization are set equal to the initial values.
40+
the CoM trajectory. However, it still closes the loop using the robot's status and assumes both
41+
feet are in contact with the ground.
42+
43+
2. The `com_knots_delta_<>` lists represent the coordinates in the CoM frame at `t=0s`. This means
44+
that the application can also be run when the robot is in single support. However, in that case,
45+
the user must ensure that the CoM trajectory remains within the support polygon and that joint
46+
tracking performance is sufficiently accurate to prevent the robot from falling.
47+
48+
3. The application solves a task-space inverse dynamics (TSID) problem to generate the joint
49+
trajectory. The control problem prioritizes the feet's position and orientation (pose) and the
50+
CoM torque while regularizing the chest orientation and joint torque to a desired
51+
configuration. The problem also ensures that the contact wrenches are feasible, generating forces
52+
and torques within the wrench cone.
53+
The desired pose of the feet, torso orientation, and joint regularization are set to the initial
54+
values.
55+
56+
4. The list of controlled joints can be found in the configuration file
57+
[`robot_control.ini`](./config/robots/ergoCubGazeboV1/blf_balancing_torque_control/robot_control.ini).
58+
Removing a joint from the `joints_list` will exclude it from the control problem. The user must
59+
also adjust the `kp`, `kd`, and `weight` values in the `[JOINT_REGULARIZATION_TASK]` section to
60+
match the new joint list in
61+
[`tsid.ini`](./config/robots/ergoCubGazeboV1/blf_balancing_torque_control/tsid.ini). By default,
62+
if a joint is not in the `joints_list`, its position is considered to be zero. This behavior can
63+
be changed by setting the `fixed_joint_list_names` and `fixed_joint_list_values` in the
64+
[`robot_control.ini`](./config/robots/ergoCubGazeboV1/blf_balancing_torque_control/robot_control.ini)
65+
file. Specifically, `fixed_joint_list_names` is a list of joint names not in the `joints_list`,
66+
and `fixed_joint_list_values` contains the corresponding joint positions (in degrees).
4267

4368
---
4469

45-
If you want to run the application for a different robot remember to create a new folder in
46-
[`./config/robots/`](./config/robots). The name of the folder should match the name of the robot.
70+
If you want to run the application for a different robot, remember to create a new folder in
71+
[`./config/robots/`](./config/robots). The folder name should match the name of the robot.

utilities/balancing-torque-control/config/robots/ergoCubGazeboV1/blf_balancing_torque_control/robot_control.ini

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ joints_list ("torso_pitch", "torso_roll", "torso_yaw
77
"r_hip_pitch", "r_hip_roll", "r_hip_yaw", "r_knee", "r_ankle_pitch", "r_ankle_roll")
88

99
remote_control_boards ("torso", "left_arm", "right_arm", "left_leg", "right_leg")
10+
1011
positioning_duration 3.0 #in seconds
11-
positioning_tolerance 0.05 #in seconds
12-
position_direct_max_admissible_error 0.1 #in seconds
12+
positioning_tolerance 0.05 #in radians
13+
position_direct_max_admissible_error 0.1 #in radians
14+
15+
# List of the names of the fixed joints. Specify here the joints that you will consider as fixed.
16+
# The joints in this list cannot be part of the controlled joints list (joints_list).
17+
# If a joint is present in both lists, an error will occur. The purpose of this list is to define a
18+
# specific configuration for the fixed joints that differs from the default value (0.0 deg).
19+
# If a joint is not included in this list or the controlled joints list, it will be considered fixed with a default value of 0.0 deg.
20+
#
21+
# Below is an example of how to specify a fixed joint with a value other than 0.0 deg:
22+
#
23+
# fixed_joint_list_names ("torso_pitch") # List of the fixed joint names
24+
# fixed_joint_list_values (10.0) # List of the fixed joint values (in degrees)
25+
26+
fixed_joint_list_names ()
27+
fixed_joint_list_values ()

utilities/balancing-torque-control/script/blf-balancing-torque-control.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,33 @@ def build_kin_dyn(self, param_handler):
313313
joint_list = param_handler.get_group(
314314
"ROBOT_CONTROL"
315315
).get_parameter_vector_string("joints_list")
316+
317+
try:
318+
fixed_joints_list = param_handler.get_group(
319+
"ROBOT_CONTROL"
320+
).get_parameter_vector_string("fixed_joint_list_names")
321+
322+
fixed_joints_values = param_handler.get_group(
323+
"ROBOT_CONTROL"
324+
).get_parameter_vector_float("fixed_joint_list_values")
325+
except:
326+
blf.log().warning("No fixed joints are provided.")
327+
fixed_joints_list = []
328+
fixed_joints_values = []
329+
330+
# check if the length of the fixed joints is correct
331+
if len(fixed_joints_list) != len(fixed_joints_values):
332+
raise ValueError(
333+
"The length of the fixed joints list and values is different."
334+
)
335+
336+
# create a dictionary with the fixed joints
337+
fixed_joints = dict()
338+
for joint_name, joint_value in zip(fixed_joints_list, fixed_joints_values):
339+
fixed_joints[joint_name] = np.deg2rad(joint_value)
340+
316341
ml = idyn.ModelLoader()
317-
ml.loadReducedModelFromFile(robot_model_path, joint_list)
342+
ml.loadReducedModelFromFile(robot_model_path, joint_list, fixed_joints)
318343

319344
kindyn = idyn.KinDynComputations()
320345
kindyn.loadRobotModel(ml.model())

0 commit comments

Comments
 (0)