Skip to content

Correcting scene orientation and rendering #1362

@JordanConvergence

Description

@JordanConvergence

I am making a simulation of a robot using Mayavi as the renderer. One of the features that I would like to be able to do is set the view point to be at the position and orientation of a camera held in the hand of the robot. I am currently able to set the position and orientation of the scene camera using the following code.

// Calculate homogenous transform of the camera in the world frame
cameraTransform = np.matmul(self.V01.armFrames[armID].transformToWorld,self.V01.arms[armID].targetPoint["transform"])

// Set the focal point in front of the camera
mlab.view(focalpoint=transformVector(cameraTransform,np.array([0,0,10])))

// Set the camera position based of homogenous transform
mlab.gcf().scene.camera.position = transformVector(cameraTransform,np.array([0,0,-10]))

// Draw the scene
mlab.draw()

After doing this, the scene shows nothing until I move the screen manually with my mouse, and then the correct view is shown. Is there an additional step that I need to do to show the scene without having to move the scene with the mouse? Can I simulate a mouse movement event so that I don't have to click on the scene each time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions