Skip to content

Commit 3582054

Browse files
committed
fix initial walk ready transition in simulation
1 parent ef302f0 commit 3582054

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@
213213
"variant": "cpp",
214214
"regex": "cpp",
215215
"future": "cpp",
216-
"*.ipp": "cpp"
216+
"*.ipp": "cpp",
217+
"span": "cpp"
217218
},
218219
// Tell the ROS extension where to find the setup.bash
219220
// This also utilizes the COLCON_WS environment variable, which needs to be set

bitbots_motion/bitbots_dynup/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ set(PYBIND11_FINDPYTHON ON)
1111

1212
find_package(ament_cmake REQUIRED)
1313
find_package(backward_ros REQUIRED)
14+
find_package(bio_ik REQUIRED)
1415
find_package(bitbots_msgs REQUIRED)
1516
find_package(bitbots_splines REQUIRED)
1617
find_package(bitbots_utils REQUIRED)
1718
find_package(control_msgs REQUIRED)
1819
find_package(control_toolbox REQUIRED)
20+
find_package(Eigen3 REQUIRED)
21+
find_package(generate_parameter_library REQUIRED)
1922
find_package(geometry_msgs REQUIRED)
2023
find_package(moveit_ros_planning_interface REQUIRED)
2124
find_package(rclcpp REQUIRED)
@@ -27,8 +30,6 @@ find_package(tf2 REQUIRED)
2730
find_package(tf2_eigen REQUIRED)
2831
find_package(tf2_geometry_msgs REQUIRED)
2932
find_package(tf2_ros REQUIRED)
30-
find_package(Eigen3 REQUIRED)
31-
find_package(generate_parameter_library REQUIRED)
3233

3334
find_package(ros2_python_extension REQUIRED)
3435
find_package(pybind11 REQUIRED)
@@ -64,13 +65,14 @@ add_executable(DynupNode ${SOURCES})
6465
ament_target_dependencies(
6566
DynupNode
6667
ament_cmake
68+
bio_ik
6769
bitbots_msgs
6870
bitbots_splines
6971
bitbots_utils
7072
control_msgs
7173
control_toolbox
72-
geometry_msgs
7374
generate_parameter_library
75+
geometry_msgs
7476
moveit_ros_planning_interface
7577
rclcpp
7678
ros2_python_extension
@@ -94,6 +96,7 @@ ament_target_dependencies(
9496
libpy_dynup
9597
PUBLIC
9698
ament_cmake
99+
bio_ik
97100
bitbots_msgs
98101
bitbots_splines
99102
bitbots_utils

bitbots_motion/bitbots_dynup/src/dynup_ik.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
#include <bio_ik/bio_ik.h> // TODO remove this include
2+
13
#include <bitbots_dynup/dynup_ik.hpp>
4+
25
namespace bitbots_dynup {
36

47
DynupIK::DynupIK(rclcpp::Node::SharedPtr node) : node_(node) {}
@@ -54,13 +57,19 @@ bitbots_splines::JointGoals DynupIK::calculate(const DynupResponse& ik_goals) {
5457
bool success;
5558
goal_state_->updateLinkTransforms();
5659

60+
// Add auxiliary goal for the knees to prevent bending in the wrong direction
61+
bio_ik::BioIKKinematicsQueryOptions leg_ik_options;
62+
leg_ik_options.return_approximate_solution = true;
63+
64+
leg_ik_options.goals.push_back(std::make_unique<bio_ik::AvoidJointLimitsGoal>());
65+
5766
success = goal_state_->setFromIK(l_leg_joints_group_, left_foot_goal_msg, 0.005,
58-
moveit::core::GroupStateValidityCallbackFn(), ik_options);
67+
moveit::core::GroupStateValidityCallbackFn(), leg_ik_options);
5968

6069
goal_state_->updateLinkTransforms();
6170

6271
success &= goal_state_->setFromIK(r_leg_joints_group_, right_foot_goal_msg, 0.005,
63-
moveit::core::GroupStateValidityCallbackFn(), ik_options);
72+
moveit::core::GroupStateValidityCallbackFn(), leg_ik_options);
6473

6574
goal_state_->updateLinkTransforms();
6675

0 commit comments

Comments
 (0)