-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add impedance control method computed in local frame for c++, fix centroidal controller quaternion bug, and transform to ROS 2 package #29
base: main
Are you sure you want to change the base?
Conversation
…dify c++ impedance algo in world frame, and modify cmake & package.xml so other ROS packages can use this
A few other changes:
Related to this PR: |
@@ -4,7 +4,7 @@ | |||
* @copyright Copyright (c) 2020, New York University and Max Planck | |||
* Gesellschaft | |||
* | |||
* @brief This is the implementation for impedance controller between any two | |||
* @brief This is the implementation for mim_control_ controller between any two |
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 think impedance was correct.
|
||
/** @brief Output torques. */ | ||
Eigen::VectorXd joint_torques_; | ||
class ImpedanceController |
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.
Use mpi_cmake_modules to change the format of your code and make it similar to others files in this repo.
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 not easy to review this package because of using a different format.
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.
Are you referring to this: https://github.com/machines-in-motion/mpi_cmake_modules/blob/master/doc/clang_format.md? If so, I couldn't get it to work (command not found even though I sourced my workspace folder). For now, I just un-indented the code.
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.
try with dash instead of underscore
run-clang-format
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.
After running run-clang-format absolute-path-to-file absolute-path-to-folder
, I get this error message: run-clang-format: error: Command 'clang-format --version' failed to start: [Errno 2] No such file or directory: 'clang-format'
. Do you know what is causing it?
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.
sudo apt install clang-format
?
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 yes, thank you
|
||
} // namespace mim_control | ||
} // namespace mim_control_ |
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.
Any reason for changing this line 🤔
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.
No reason, I think I did a search and replace which was wrong. I reverted it back.
@@ -1,10 +1,3 @@ | |||
################################################################################################################## |
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.
Any reason for deleting this? You can use a different format if you want it to look like others.
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 sure what happened, I added it back.
@@ -70,7 +63,8 @@ def compute_com_wrench(self, q, dq, des_pos, des_vel, des_ori, des_angvel): | |||
vcom = np.reshape(np.array(dq[0:3]), (3,)) | |||
Ib = robot.mass(q)[3:6, 3:6] | |||
|
|||
quat_diff = self.quaternion_difference(arr(q[3:7]), arr(des_ori)) | |||
tmp = pin.Quaternion(des_ori[3], des_ori[0], des_ori[1], des_ori[2]) * pin.Quaternion(q[6], q[3], q[4], q[5]).conjugate() |
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.
Does self.quaternion_difference work? If it doesn't work, please replace your code with the code in the function and here only call the function.
Description
I added a C++ impedance control method called
ImpedanceController::run_local()
that is equivalent tocompute_impedance_torques()
in the python/impedance_controller.py. This made it easier for me to write this file in C++.How I Tested
I tested this on SOLO-12 in Gazebo.
I fulfilled the following requirements