sot-core icon indicating copy to clipboard operation
sot-core copied to clipboard

Converting quaternien vector into rpy

Open jviereck opened this issue 5 years ago • 7 comments

Hi,

given a dg::vector representing a quaternion as x, y, z, w, is there a way to convert it to a rpy vector?

There is a QuaternionToMatrix and MatrixToRPY entity here 1. However, I cannot figure out how to get a dg::vector into a VectorQuaternion type.

Best Julian

jviereck avatar Jan 16 '20 19:01 jviereck

You look for an entity or a Python function ?

jmirabel avatar Jan 17 '20 08:01 jmirabel

I now understand your question. I don't see any QuaternionToRPY in src/matrix/operator.cpp so I guess there is none. I wouldn't be hard to write though.

jmirabel avatar Jan 17 '20 08:01 jmirabel

I think I have an entity doing more or less that in sot-talos-balance

gabrielebndn avatar Jan 17 '20 08:01 gabrielebndn

Thanks for providing the implementation in #121.

What I am missing is also how to get a dg:vector as a VectorQuaternion. When I try to plug a dg::vector as input to a VectorQuaternion, I am getting a type error.

jviereck avatar Jan 17 '20 09:01 jviereck

Can you provide an example code ?

jmirabel avatar Jan 17 '20 10:01 jmirabel

Here is a reduced example with the corresponding error message:

import dynamic_graph as dg
import dynamic_graph.sot.core

vec = dynamic_graph.sot.core.vector_constant.VectorConstant('vc')
vec.sout.value = (0, 0, 0, 1)

op = dynamic_graph.sot.core.operator.QuaternionToMatrix('q2m')
dg.plug(vec.sout, op.sin)

# dgpyError: Compl. Uncompatible types for plugin.(while trying to plug 
# <sotVectorConstant(vc)::output(vector)::sout> on 
# <QuaternionToMatrix(q2m)::input(VectorQuaternion)::sin>) with types 
# <N5Eigen10QuaternionIdLi0EEE> on <PN12dynamicgraph10SignalBaseIiEE>.

jviereck avatar Jan 21 '20 10:01 jviereck

I see your problem. I don't think it is implemented.

jmirabel avatar Jan 21 '20 15:01 jmirabel