Frame for Orientation in OSG

I want to maintain orientation and I am using an operational space control example given in dart. I am not sure how to add a frame representing orientation to the example and it will be great if I can also change orientation with a keyboard. I think that orienation can be added in the constraintEventHandler function. However, I am not sure how to add FrameOrientation associated with target/

I will really appreciate any help.


Currently the error term in the example only looks at positional error. It doesn’t consider orientation error at all. So you would need to change the 3-dimensional translational error term e into a 6-dimensional screw error term where the new 3 dimensions represent orientation error.

You should also use the full Jacobian instead of just the linear (translational) components of the Jacobian.

I would also recommend that you scale the angular components of your error vector relative to the linear components of your error vector, otherwise the controller will aggressively favor correcting the orientation instead of correcting the translation whenever it’s having trouble finding a good solution for both.

Thank you for the reply. I also wanted to ask that if I want to add orientation vector in that example, what would be the best approach to address this?

Do you mean how to compute an orientation error? I usually use Eigen::AngleAxisd for that.

Another approach would be to use Euler angles. You can find an example of computing orientation error using Euler angles in the DART inverse kinematics source code.

Hi Grey,
Thank you for the message. I am using quaternions for the orientation and I am using “Closed-loop manipulator control using quaternion feedback”. I was having trouble in introducing the reference frame for the orientation in the world and then moving it via keyboard. For the end effector orientation representation, I was referring to your comment at but I as not able to figure out an arbitrary frame in the world. I was able to create one but it got bounded to the base. Any guidance will be highly appreciateable.


If you’re able to share your code, I may be able to spot where your issue is.

When you create a SimpleFrame object, you can move it around however you’d like, as long as you keep a mutable reference to it, so without seeing your code I can’t really know what problem you’re running into.