Skip to content

Consider Slerp instead of Squad for rotation interpolation #568

@jrutgeer

Description

@jrutgeer

I am using the gz-gui camera tracking plugin to adapt the simulation viewpoint throughout the simulation.

I noticed that motion is sometimes 'shaky' due to the rotation interpolation, e.g. :

$ gz service -s /gui/move_to/pose --reqtype gz.msgs.GUICamera --reptype gz.msgs.Boolean --timeout 500 --req 'pose: {position:{x: 27.2, y:-1.7215,z:2.2255}, orientation:{x:-0.1466788, y:0.0344671, z:0.9623708, w:0.2261413}}'
$ gz service -s /gui/move_to/pose --reqtype gz.msgs.GUICamera --reptype gz.msgs.Boolean --timeout 500 --req 'pose: {position:{x:24.081968307495117,y:1.0910710096359253,z:1.194319486618042},orientation:{x:0.10836052149534225,y:-0.0045970650389790535,z:-0.99320769309997559,w:-0.042135711759328842}}'
squad.mp4

Changing this single line:

return Quaterniond::Squad(_t, p, a, b, q, _useShortestPath);

to use Slerp instead of Squad solves the issue:

  return Quaterniond::Slerp(_t, p, q, _useShortestPath);
slerp.mp4

Is it an option to change this to slerp instead of squad?
Why was squad chosen (I don't find references through 'git blame', seems it was squad from the first commit?)

It seems this is a good reference wrt rotation interpolation:

https://splines.readthedocs.io/en/latest/rotation/index.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions