octovis - tracking positon of object (orientation)

22 views
Skip to first unread message

Pete Flugstad

unread,
May 17, 2019, 10:13:06 AM5/17/19
to OctoMap developers and users discussion
Hi,

   I'm rendering an object on top of octovis's octomap (I have an underlying octomap as well) using something very similar to Trajectory Drawer (which I started from).  This objects position is updated at approx 1Hz.  I would like to have the camera track that object at a fixed offset and orientation.

  When I enable tracking, I take a delta between the camera and the current position of the object.  Then, every time the object position is updated, I apply that delta to the new object position and that is the new camera position.  I call ViewerWidget::setCamPosition, with that new position as the new x, y, z values and the actual object position as the lookX/Y/Z values.  This does not seem to work - I believe I'm tracking the position correctly, but the orientation is off.

  I've tried editing ViewerWidget::setCamPosition commenting out the call to camera()->setOrientation and/or camera()->setUpVector, but that didn't work either.  Note that, because of the way my octomap is derived, I'm actually "underneath" the octomap - not that that really should matter I think?

  I've tried capturing the camera orientation when I enable tracking so I can restore it when the object position updates (I added new functions to ViewerWidget to let me just set the position and orientation), but that didn't work. 

  I think I'm missing something about how QGLViewer works with this camera() and frame().  Any suggestions?

Thanks,
Pete
Reply all
Reply to author
Forward
0 new messages