-
Notifications
You must be signed in to change notification settings - Fork 58
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
KDL based Movement in Cartesian Space #167
KDL based Movement in Cartesian Space #167
Conversation
tutorial of KDL installation and demo of Cartesian space movement based on KDL, including forward kinematics and inverse kinematics based on KDL
This demo, based on forward kinematics and inverse kinematics provided by KDL, makes the robot move in z axis in Cartesian space. About how to run this demo, please refer to 'KDL installation and demo.pdf' in the directory './lbr_demos_fri_ros2_cpp/doc/KDL installation and demo.pdf'.
thank you for the PR @BoWangFromMars. I would create a development branch so you can re-target the PR against this branch. Then I can make some modifications to the PR on the dev branch. |
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.
Reviewed your PR. Could you please amend changes. Not all suggestions might make sense, so feel free to keep things that make sense to you
phase_ = 0.0; | ||
count_= 0.0; | ||
|
||
std::string urdf_file_path = "/home/nearlab-iiwa/lbr-stack/src/lbr_fri_ros2_stack/lbr_description/urdf/iiwa7/my_iiwa7.urdf"; // path of your robot urdf 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.
would it be possible to load this from the /robot_description
parameter instead
lbr_demos/lbr_demos_fri_ros2_cpp/src/cartesian_path_planning_node.cpp
Outdated
Show resolved
Hide resolved
lbr_demos/lbr_demos_fri_ros2_cpp/src/cartesian_path_planning_node.cpp
Outdated
Show resolved
Hide resolved
{ | ||
current_robot_state = msg; | ||
|
||
if(count_ < 200) // in first 2 seconds, to make 'initial_position_command' be 'measured_joint_position' |
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.
might be better to introduce is_init
bool or turn current_robot_state
into unique pointer and check for null
KDL::JntArray result_joint_positions = KDL::JntArray(chain.getNrOfJoints()); | ||
lbr_fri_msgs::msg::LBRPositionCommand joint_position_command; | ||
|
||
auto start = std::chrono::high_resolution_clock::now(); |
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.
maybe only measure time on debug
{ | ||
KDL::Frame cartesian_position_command = initial_cartesian_position; | ||
|
||
cartesian_position_command.p = KDL::Vector(initial_cartesian_position.p.x(), initial_cartesian_position.p.y(), initial_cartesian_position.p.z() + amplitude_ * sin(phase_)); |
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.
oh okay I see, this performs oscillation in Cartesian space, could you maybe add a Cartesian pose topic or even better a Twist topic (to indicate velocity commands) instead? Twist commands might need some code changes
The function of this node is to publish Cartesian Pose state of the robot and receive Cartesian Pose Command from other ros nodes.
This file introduces how to install KDL(kinematics and dynamics library) in our system and a demo based on it is given to make the robot run in z direction in Cartesian space.
This node publishes Cartesian Pose command.
This node, as a demo, publishes Cartesian Pose command to make the robot run in z direction in Cartesian space.
This node publishes Cartesian Pose state of the robot and receives Cartesian Pose command from other ros nodes, and transform it into joint positions based on KDL to send to the robot.
so ideally the robot descriptions will be loaded from the From TopicCreate subscription to
From ParameterRefer e.g. lbr_fri_ros2_stack/lbr_demos/lbr_demos_fri_ros2_advanced_cpp/src/admittance_control_node.cpp Line 17 in 036b23b
|
@@ -0,0 +1,229 @@ | |||
<?xml version="1.0" ?> |
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.
these files are redundant
|
||
// get the path of urdf file | ||
std::filesystem::path current_working_directory = std::filesystem::current_path(); | ||
std::string urdf_file_path = current_working_directory.string() |
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.
getting the current path might not work in general
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.
Hello, @mhubii, thank you very much for your suggestion and QoS documentation, I learn a lot from it. I modify my code following your advice today and then upload it again after I test 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.
awesome, happy to merge once the /robot_description
is loaded from topic / parameter and .urdf
files are removed
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.
some more dependency hints
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.
one more question regarding this doc. KDL is usually installed through rosdep
as listed in package.xml
files, refer e.g.
<depend>orocos_kdl_vendor</depend> |
<depend>urdf</depend> | ||
<depend>geometry_msgs</depend> | ||
<depend>sensor_msgs</depend> | ||
<depend>orocos_kdl</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.
this dependency should be replaced by orocos_kdl_vendor
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.
okay, I get it, thank you.
thank you again for the PR @BoWangFromMars. I merged this into the If you want to make amend changes yourself, please add a PR to the dev branch again. |
KDL(Kinematics and Dynamics Library) installation process is introduced in this branch. Based on forward kinematics and inverse kinematics provided by KDL, a demo, which makes the robot move in z axis in Cartesian space, is added in this branch. Please see the detailed information in pdf file "KDL installation and demo.pdf" in the directory './lbr_demos_fri_ros2_cpp/doc'.