-
Couldn't load subscription status.
- Fork 13
Add method to get the next position for each foot of SOLO, add ROS 2 demos, and transform project to ROS2 package #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@swuuu thanks a lot for the improvements. |
This PR is related to this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is nice, but I do not understand the need for ament cmake here
| """Demo file for running the reactive planner on SOLO 12 | ||
| The logic is the same as the demo_reactive_planners_solo12_step_adjustment_walk.ipynb | ||
| This file is used for ROS 2. An example of the usage of this class is here: | ||
| https://github.com/swuuu/ros2_controllers_solo12/blob/master/ros2_control_test_nodes/ros2_control_test_nodes/node.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that you update ros2_controllers_solo12 in the stack-of-tasks organization here, not in your GitHub.
Replace the link above with the one in stack-of-tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that Olivier Stasse didn't want the packages containing the controllers to be in that repository: stack-of-tasks/ros2_control_solo#1 (review). Perhaps we could ask him to create a new repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's totally fine. It's important to make sure it won't be multiple versions of the same code to avoid bugs:)
Create a new repository on your GitHub ros2_demo_solo for all demo nodes that we will have (or any name that you think is good ). We will add it to McGill organization GitHub in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then I suggest to use a name that represent you organisation like we had with the machines-in-motion group:
mim_control
| class Demo: | ||
| """ | ||
| Based on https://github.com/machines-in-motion/reactive_planners/blob/master/demos/demo_reactive_planners_solo12_step_adjustment_walk.ipynb | ||
| The 4 parameters to control the direction of SOLO are y_des, yaw_des, com_des, and v_des. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest changing y_des's name to yaw_velocity_des.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
| @@ -0,0 +1,317 @@ | |||
| """Demo file for running the reactive planner on SOLO 12 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, we write a demo as a runnable file with the possibility of changing parameters based on user preference.
Your Demo class looks easy to understand and useful for users. write a main which call Demo class.
@MaximilienNaveau Do you think it's better to put the Demo class in the python folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not it's fine here.
I would just write a small main at the bottom of the file to run 1 reversion of the demo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can write a main() function. But as @Lhumd suggested, could I move this file to the python/reactive_planners/demos folder so that CMake will install() the script so I can use it in another package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah if you want this demo to be part of the public API (other package can use it) then you must move it to the python folder.
But then find another name than demo something saying it's specific to solo and that it's a controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the main function, you want me to run the code in pybullet. Is that correct?
| :return: torques to send to SOLO | ||
| """ | ||
| # normalize the quat (maybe not needed) | ||
| normalized_quat = pin.Quaternion( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If q comes from Pinocchio or simulation means you are sure that q is correct, there is no need to normalize the quaternion.
| q[6] = normalized_quat[3] | ||
|
|
||
| # transform the base velocity to the local frame | ||
| curr_orientation = normalized_quat.matrix() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| xd_com = self.robot.pin_robot.com(q, qdot)[1] | ||
|
|
||
| # update the relevant params for the centroidal controller depending on the command | ||
| if action == "forward": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this class as a generic class, I prefer not to limit the motion to the actions you wrote here. I suggest writing this part in a more general way without 'action'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just input v_des = [v_x, v_y, v_yaw]
| * | ||
| * @brief A C++ translation of the demos/demo_reactive_planners_solo12_step_adjustment_walk.ipynb script (the first part) | ||
| * | ||
| * The 4 fields to control the direction of SOLO are y_des, yaw_des, com_des, and v_des |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here for y_des
| * | ||
| * @brief Implement the | ||
| * reactive_planners::demo_reactive_planners_solo12_step_adjustment class | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember, the goal was to write a demo using C++ for solo12 to publish the torque on ros2. I didn't find any demo which does it in your pull request:-?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it wouldn't really be the place to put that in.
If you wanna ROS2 integration better create a ros2_reactive_planners package or a ros2_control_reactive_planners, whatever name is clear for you to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| */ | ||
| compute_torques(Eigen::Matrix<double, 19, 1> &q, Eigen::Matrix<double, 18, 1> &dq, double control_time, const std::string& direction); | ||
|
|
||
| void quadruped_dcm_reactive_stepper_start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use Doxygen to generate documentation. Please add comments for every function and variable that you defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in vscode there are some tools to help you write the doc for method and attribute
| @@ -0,0 +1,317 @@ | |||
| """Demo file for running the reactive planner on SOLO 12 | |||
| The logic is the same as the demo_reactive_planners_solo12_step_adjustment_walk.ipynb | |||
| This file is used for ROS 2. An example of the usage of this class is here: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you say it is used for ROS2? do you depend on ROS2? do you use rclcpp or rclpy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have a ROS 2 node that uses demo_reactive_planners_solo12_step_adjustment_walk.py and demo_reactive_planners_solo12_step_adjustment_walk.cpp. We use both rclcpp and rclpy. But I agree, both the c++ and Python reactive planner demo files do not need to be used in a ROS2 node.
| <license>BSD-3-Clause</license> | ||
|
|
||
| <depend>mpi_cmake_modules</depend> | ||
| <depend>yaml_utils</depend> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure you list all dependencies if you use such package.xml
make sure you add the build_tool you want use and export it:
<!-- The following tags are recommended by REP-136 -->
<exec_depend condition="$ROS_VERSION == 1">catkin</exec_depend>
<exec_depend condition="$ROS_VERSION == 2">ament_cmake</exec_depend>
<buildtool_depend>cmake</buildtool_depend>
<export>
<build_type>cmake</build_type>
</export>
package.xml
Outdated
| <depend>mpi_cmake_modules</depend> | ||
| <depend>yaml_utils</depend> | ||
|
|
||
| </package> No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a new line in the end of all files
| Eigen::Vector3d hind_left_next_foot_position_ = | ||
| biped_stepper_.get_next_support_foot_position() + base_yaw_rot * hl_offset_; | ||
|
|
||
| next_step_feet_pos.row(0) << front_left_next_foot_position_(0), front_left_next_foot_position_(1), front_left_next_foot_position_(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next_step_feet_pos.row(0) << front_left_next_foot_position_; works here
CMakeLists.txt
Outdated
| INCLUDES | ||
| DESTINATION include) | ||
|
|
||
| # Install the header files so other ROS packages can find them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Install the header files so other ROS packages can find them should be:
# Install the header files so other packages depending on this one can find them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the work implementing example of the code.
Now if you wanna implement this on a real quadruped I suggest you actually create a ros2_reactive_planners package using ament_cmake this time and use either ros2_control controller API or rclcpp API to publish you input torque to the robot.
|
@MaximilienNaveau Thanks for the review. |
…control, and change y_des to yaw_velocity_des
…and add namespace
Description
I added a method to get the next position for each foot of SOLO.
How I Tested
I have compiled and tested this repository on SOLO-12 in Gazebo.
I fulfilled the following requirements