4 ms·
Noooo, I didn't clarify enough. Represent your axes with the actual angles. These probably correspond to motor position or revolutions. Use the quaternions on
by xaedes 5y ago
Noooo, I didn't clarify enough.
Represent your axes with the actual angles. These probably correspond to motor position or revolutions.
Use the quaternions only when you want an orientation for these angles.
Maybe you want to know in which direction the PTU is pointing for a particular set of motor positions, or axis angles. Compute the kinematic chain by multiplying the quaternions corresponding to each axis in the order they are physically applied, but multiply from right to left. Your final result is one quaternion representing the direction the PTU is pointing at. (You could also use 3x3 matrices or other representations) Depending on your physical configuration one of the Euler angle variants (Tait–Bryan angles is another term to search for) could perfectly describe your case and you could just use these to store the angles and compute the orientation.
If you don't actually need the final orientation, then you can omit the quaternions altogether.
If you have orientations as input and need to control the motors so the PTUs are pointing in the required direction:
I would compute the current orientation of the PTU. Then compute a trajectory of quaternions interpolating from the current orientation to the target orientation (use quaternion slerp for interpolation).
Then at each timestep you compute the required motor positions using inverse kinematics [1].
It is a common problem that multiple motor positions are possible and actually an unfinished research problem.
Now that I wrote this, I think this might be the problem you are encountering.
For PTU I think it would be ok to try to recover the current target angles from the target quaternions of the trajectory using one of the Euler configurations. There are papers [2] listing all together, so one can try which is correct.
Having a configuration chosen there is still the problem of multiple solutions. In this case use the one closest to the actual current angles. For cases when all angles are possible for an axis, use the current angle as target (i.e. motor doesn't change). When you then have an target angle use `wrapToPiSeq` to get an equivalent angle close the current actual angle as input for the motor controller.
[1] https://en.wikipedia.org/wiki/Inverse_kinematics https://en.wikipedia.org/wiki/Inverse_kinematics
In computer animation and robotics, inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain, such as a robot manipulator or animation character's skeleton, in a given position and orientation relative to the start of the chain.
[2] In the past I used this (but be careful in which direction they apply the transformations, I stumbled over this):
Diebel, J. (2006). Representing attitude: Euler angles, unit quaternions, and rotation vectors. Matrix, 58(15-16), 1-35.
https://www.astro.rug.nl/software/kapteyn/_downloads/fa29752e4cd69adcfa2fc03b1c020f4e/attitude.pdf https://www.astro.rug.nl/software/kapteyn/_downloads/fa29752...
- xaedes 5y agoWhen switching target orientation while already approaching one I would use quadratic bezier splines to get a smooth switch (https://ibiblio.org/e-notes/Splines/bezier.html https://ibiblio.org/e-notes/Splines/bezier.html). These just use linear interpolation, multiple times. In the case of quaternions replace the linear interpolations with quaternion slerps and you get quadratic bezier splines over orientations.
- neonological 5y agoI'm not sure how we do it in this case. I know we already follow a trapezoidal velocity profile when approaching a target, but mid switch to another target I'm not sure what we're using. Thanks for this, I will look into it.
- neonological 5y ago> In this case use the one closest to the actual current angles. For cases when all angles are possible for an axis, use the current angle as target (i.e. motor doesn't change). When you then have an target angle use `wrapToPiSeq` to get an equivalent angle close the current actual angle as input for the motor controller. Yeah that's how I solved this issue. But still if we avoided quaternions we wouldn't have this problem all together, which is my point. Specifically what's going on is that we're sending quaternion values over the network and the person on the receiving end needs YPR so we're basically like wtf, there's no transformations being performed on the quat, the source of info is a YPR and the output is needed is the same exact YPR so we're only converting to a company wide Quat Protobuf type to send over the wire. I submitted a request to make a new protobuf type that included YPR but I was met with huge company resistance from other engineers saying that a YPR was redundant to a Quat (It's not). >In computer animation and robotics, inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain, such as a robot manipulator or animation character's skeleton, in a given position and orientation relative to the start of the chain. Interesting, but yeah the application in my company is just a single gimbal so there's no chain of "joints" here. I don't think this would apply to our my specific case. >https://www.astro.rug.nl/software/kapteyn/_downloads/fa29752e4cd69adcfa2fc03b1c020f4e/attitude.pdf https://www.astro.rug.nl/software/kapteyn/_downloads/fa29752... Thanks for all your input. I'll take a look at the link above, it looks interesting.