ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Fri, 17 May 2019 09:31:01 -0500How to ensure the tip of the end effector is facing toward the center of the objecthttps://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/I'm using kuka youbot now. Current situation is that I have set the coordinate for the tip of it's end effector and an object is situated at the center of the workspace. Supposingly, when the tip of the end effector reaches the coordinate I set, it should face toward the center of my object. After I set the xyz coordinate in the inverse kinematic code, the tip of the end effector do move to the coordinate I set, but it do not face towards the center point of the object I set. So, may I know is there any way to ensure the tip of the end effector is facing toward the center of the object? Or is there a way to ensure the joint 3 to the tip of the end effector is in 90 degree from the x-axis?Wed, 15 May 2019 08:40:14 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/Answer by Delb for <p>I'm using kuka youbot now. Current situation is that I have set the coordinate for the tip of it's end effector and an object is situated at the center of the workspace. Supposingly, when the tip of the end effector reaches the coordinate I set, it should face toward the center of my object. After I set the xyz coordinate in the inverse kinematic code, the tip of the end effector do move to the coordinate I set, but it do not face towards the center point of the object I set. So, may I know is there any way to ensure the tip of the end effector is facing toward the center of the object? Or is there a way to ensure the joint 3 to the tip of the end effector is in 90 degree from the x-axis?</p>
https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?answer=323266#post-id-323266From kuka's website at [youbot inverse kinematic](http://www.youbot-store.com/developers/youbot-ros-inverse-kinematics) :
> The input data is a 6D-Pose consisting
> of the x-y-z coordinates and the
> roll-pitch-yaw orientation of the
> gripper
So if you know the coordinates of the center of your object you can find the `roll`, `pitch` and `yaw` required to face it and just specify it in the input.
----------
EDIT as response to your comment :
> do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution?
No, it means that the pose is not only `{ x; y; z}` (`3-D`) but it's `{ x; y; z; roll; pitch; yaw}` (`6-D`).
> but how do I find the roll pitch and yaw required from the coordinate I put
If you want to find the orientation required to face the object you need the coordinates of your object and your end effector frame coordinates. You will need to do some steps :
1. Using the transformation of arm link 1 to arm link 4 that you've calculated, you have to convert the **object** coordinates from your global frame to the end_effector frame.
2. Once you have the object coordinates in end effector frame, you need to convert them from carthesian to spherical (you can have the conversion formulas [here](https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates) to have coordinates as `{ z; theta; phi}`. `theta` being the angle around `z` axis and `phi` the angle around `x` axis).
3. Assuming that it's the direction of the `x` axis of your end effector frame that determine what your end effector faces : You know that if the end effector is facing the object then `theta = 0` and `phi=pi/2`. You also know that `phi` and `theta` are the same as respectively `roll` and `theta` (you don't need the pitch).
4. Just by calculating the spherical coordinates you directly find the `roll` and `yaw` that needs to be applied to properly set the end effector, so just by substracting those `roll` and `yaw` to the `roll` and `yaw` calculated at `step 1`, you get the `roll`, `pitch` and `yaw` required in the input data of your inverse kinematic code.Wed, 15 May 2019 09:39:54 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?answer=323266#post-id-323266Comment by Shuu for <p>From kuka's website at <a href="http://www.youbot-store.com/developers/youbot-ros-inverse-kinematics">youbot inverse kinematic</a> :</p>
<blockquote>
<p>The input data is a 6D-Pose consisting
of the x-y-z coordinates and the
roll-pitch-yaw orientation of the
gripper</p>
</blockquote>
<p>So if you know the coordinates of the center of your object you can find the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required to face it and just specify it in the input.</p>
<hr>
<p>EDIT as response to your comment :</p>
<blockquote>
<p>do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution? </p>
</blockquote>
<p>No, it means that the pose is not only <code>{ x; y; z}</code> (<code>3-D</code>) but it's <code>{ x; y; z; roll; pitch; yaw}</code> (<code>6-D</code>).</p>
<blockquote>
<p>but how do I find the roll pitch and yaw required from the coordinate I put</p>
</blockquote>
<p>If you want to find the orientation required to face the object you need the coordinates of your object and your end effector frame coordinates. You will need to do some steps :</p>
<ol>
<li>Using the transformation of arm link 1 to arm link 4 that you've calculated, you have to convert the <strong>object</strong> coordinates from your global frame to the end_effector frame.</li>
<li>Once you have the object coordinates in end effector frame, you need to convert them from carthesian to spherical (you can have the conversion formulas <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates">here</a> to have coordinates as <code>{ z; theta; phi}</code>. <code>theta</code> being the angle around <code>z</code> axis and <code>phi</code> the angle around <code>x</code> axis).</li>
<li>Assuming that it's the direction of the <code>x</code> axis of your end effector frame that determine what your end effector faces : You know that if the end effector is facing the object then <code>theta = 0</code> and <code>phi=pi/2</code>. You also know that <code>phi</code> and <code>theta</code> are the same as respectively <code>roll</code> and <code>theta</code> (you don't need the pitch).</li>
<li>Just by calculating the spherical coordinates you directly find the <code>roll</code> and <code>yaw</code> that needs to be applied to properly set the end effector, so just by substracting those <code>roll</code> and <code>yaw</code> to the <code>roll</code> and <code>yaw</code> calculated at <code>step 1</code>, you get the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required in the input data of your inverse kinematic code.</li>
</ol>
https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323437#post-id-323437The x axis of end effector and joint 3 will be parallel if only if the positive and negative distance from the reference frame is same.
Sorry, is z-coordinate*. The inputs of tf is from the source frame of arm link 0 to arm link 5.Fri, 17 May 2019 09:31:01 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323437#post-id-323437Comment by Delb for <p>From kuka's website at <a href="http://www.youbot-store.com/developers/youbot-ros-inverse-kinematics">youbot inverse kinematic</a> :</p>
<blockquote>
<p>The input data is a 6D-Pose consisting
of the x-y-z coordinates and the
roll-pitch-yaw orientation of the
gripper</p>
</blockquote>
<p>So if you know the coordinates of the center of your object you can find the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required to face it and just specify it in the input.</p>
<hr>
<p>EDIT as response to your comment :</p>
<blockquote>
<p>do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution? </p>
</blockquote>
<p>No, it means that the pose is not only <code>{ x; y; z}</code> (<code>3-D</code>) but it's <code>{ x; y; z; roll; pitch; yaw}</code> (<code>6-D</code>).</p>
<blockquote>
<p>but how do I find the roll pitch and yaw required from the coordinate I put</p>
</blockquote>
<p>If you want to find the orientation required to face the object you need the coordinates of your object and your end effector frame coordinates. You will need to do some steps :</p>
<ol>
<li>Using the transformation of arm link 1 to arm link 4 that you've calculated, you have to convert the <strong>object</strong> coordinates from your global frame to the end_effector frame.</li>
<li>Once you have the object coordinates in end effector frame, you need to convert them from carthesian to spherical (you can have the conversion formulas <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates">here</a> to have coordinates as <code>{ z; theta; phi}</code>. <code>theta</code> being the angle around <code>z</code> axis and <code>phi</code> the angle around <code>x</code> axis).</li>
<li>Assuming that it's the direction of the <code>x</code> axis of your end effector frame that determine what your end effector faces : You know that if the end effector is facing the object then <code>theta = 0</code> and <code>phi=pi/2</code>. You also know that <code>phi</code> and <code>theta</code> are the same as respectively <code>roll</code> and <code>theta</code> (you don't need the pitch).</li>
<li>Just by calculating the spherical coordinates you directly find the <code>roll</code> and <code>yaw</code> that needs to be applied to properly set the end effector, so just by substracting those <code>roll</code> and <code>yaw</code> to the <code>roll</code> and <code>yaw</code> calculated at <code>step 1</code>, you get the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required in the input data of your inverse kinematic code.</li>
</ol>
https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323412#post-id-323412> x-axis of the end effector and joint 3 is parallel
Is it always true ?
> I can apply trigonometry function for my joint 3 right?
If you managed to calculate the angle required with trigonomerty yes it's fine, there are always different methods to achieve something.
> z-axis is different from the rosrun tf.
Which `z-axis` and what are the inputs `tf` of `tf_echo` ?
Same comment as in [#q323393](https://answers.ros.org/question/323046/how-to-get-the-actual-coordinate-for-all-of-the-joint/?comment=323393#post-id-323393), maybe you should open a new question detailling your calculations and ask where it failed instead of adding a new question within another one.Fri, 17 May 2019 02:18:06 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323412#post-id-323412Comment by Shuu for <p>From kuka's website at <a href="http://www.youbot-store.com/developers/youbot-ros-inverse-kinematics">youbot inverse kinematic</a> :</p>
<blockquote>
<p>The input data is a 6D-Pose consisting
of the x-y-z coordinates and the
roll-pitch-yaw orientation of the
gripper</p>
</blockquote>
<p>So if you know the coordinates of the center of your object you can find the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required to face it and just specify it in the input.</p>
<hr>
<p>EDIT as response to your comment :</p>
<blockquote>
<p>do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution? </p>
</blockquote>
<p>No, it means that the pose is not only <code>{ x; y; z}</code> (<code>3-D</code>) but it's <code>{ x; y; z; roll; pitch; yaw}</code> (<code>6-D</code>).</p>
<blockquote>
<p>but how do I find the roll pitch and yaw required from the coordinate I put</p>
</blockquote>
<p>If you want to find the orientation required to face the object you need the coordinates of your object and your end effector frame coordinates. You will need to do some steps :</p>
<ol>
<li>Using the transformation of arm link 1 to arm link 4 that you've calculated, you have to convert the <strong>object</strong> coordinates from your global frame to the end_effector frame.</li>
<li>Once you have the object coordinates in end effector frame, you need to convert them from carthesian to spherical (you can have the conversion formulas <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates">here</a> to have coordinates as <code>{ z; theta; phi}</code>. <code>theta</code> being the angle around <code>z</code> axis and <code>phi</code> the angle around <code>x</code> axis).</li>
<li>Assuming that it's the direction of the <code>x</code> axis of your end effector frame that determine what your end effector faces : You know that if the end effector is facing the object then <code>theta = 0</code> and <code>phi=pi/2</code>. You also know that <code>phi</code> and <code>theta</code> are the same as respectively <code>roll</code> and <code>theta</code> (you don't need the pitch).</li>
<li>Just by calculating the spherical coordinates you directly find the <code>roll</code> and <code>yaw</code> that needs to be applied to properly set the end effector, so just by substracting those <code>roll</code> and <code>yaw</code> to the <code>roll</code> and <code>yaw</code> calculated at <code>step 1</code>, you get the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required in the input data of your inverse kinematic code.</li>
</ol>
https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323270#post-id-323270do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution?
Next, I do know the coordinates of the center of my object, but how do I find the roll pitch and yaw required from the coordinate I put, in order for it to face it? I do get the roll pitch and yaw from the transformation
of arm link 1 to arm link 4 though, which do not point toward the center point. So, do I change the rpy of joint 3 based on the rpy I got from there?Wed, 15 May 2019 10:09:26 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323270#post-id-323270Comment by Shuu for <p>From kuka's website at <a href="http://www.youbot-store.com/developers/youbot-ros-inverse-kinematics">youbot inverse kinematic</a> :</p>
<blockquote>
<p>The input data is a 6D-Pose consisting
of the x-y-z coordinates and the
roll-pitch-yaw orientation of the
gripper</p>
</blockquote>
<p>So if you know the coordinates of the center of your object you can find the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required to face it and just specify it in the input.</p>
<hr>
<p>EDIT as response to your comment :</p>
<blockquote>
<p>do 6-D pose means that if the end effector move to a certain coordinate, it has 6 solution? </p>
</blockquote>
<p>No, it means that the pose is not only <code>{ x; y; z}</code> (<code>3-D</code>) but it's <code>{ x; y; z; roll; pitch; yaw}</code> (<code>6-D</code>).</p>
<blockquote>
<p>but how do I find the roll pitch and yaw required from the coordinate I put</p>
</blockquote>
<p>If you want to find the orientation required to face the object you need the coordinates of your object and your end effector frame coordinates. You will need to do some steps :</p>
<ol>
<li>Using the transformation of arm link 1 to arm link 4 that you've calculated, you have to convert the <strong>object</strong> coordinates from your global frame to the end_effector frame.</li>
<li>Once you have the object coordinates in end effector frame, you need to convert them from carthesian to spherical (you can have the conversion formulas <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates">here</a> to have coordinates as <code>{ z; theta; phi}</code>. <code>theta</code> being the angle around <code>z</code> axis and <code>phi</code> the angle around <code>x</code> axis).</li>
<li>Assuming that it's the direction of the <code>x</code> axis of your end effector frame that determine what your end effector faces : You know that if the end effector is facing the object then <code>theta = 0</code> and <code>phi=pi/2</code>. You also know that <code>phi</code> and <code>theta</code> are the same as respectively <code>roll</code> and <code>theta</code> (you don't need the pitch).</li>
<li>Just by calculating the spherical coordinates you directly find the <code>roll</code> and <code>yaw</code> that needs to be applied to properly set the end effector, so just by substracting those <code>roll</code> and <code>yaw</code> to the <code>roll</code> and <code>yaw</code> calculated at <code>step 1</code>, you get the <code>roll</code>, <code>pitch</code> and <code>yaw</code> required in the input data of your inverse kinematic code.</li>
</ol>
https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323394#post-id-323394I kind of have the idea of that, but I do not know how to write in my cpp code, since my coding is not that good. However, from my understanding, if the direction of x-axis of the end effector and joint 3 is parallel, I can use trigonometry function to calculate the angle I want for the joint 3 to bend in order to point toward the center point right? I have used trigonometry function to obtain the angle and add it into my joint 3, after measuring, I found out that the measured angle and my calculated angle is almost similar. So, I can apply trigonometry function for my joint 3 right? Just as the another question I asked, but my z-axis is different from the rosrun tf.Thu, 16 May 2019 22:55:49 -0500https://answers.ros.org/question/323256/how-to-ensure-the-tip-of-the-end-effector-is-facing-toward-the-center-of-the-object/?comment=323394#post-id-323394