raisimTech / raisimOgre

Other
25 stars 20 forks source link

Multiple threads for different views #23

Closed edward9503 closed 2 years ago

edward9503 commented 2 years ago

Hi there,

thanks for the awesome library.

Recently, I try to control the ANYmal C in raisimOgre. I want to have two different views: one is from an arbitrary direction which can see the ANYmal, where the other one is the view from the front camera. I tried initializing two separate visualizers, and always set the CameraMan position and orientation exactly the same as the front camera. However, it seems that I can only run one visualizer at one time. So I was wondering is it possible to add an additional camera view in raisimOgre?

Many Thanks Shengzhi

jhwangbo commented 2 years ago

nope. It's not supported.

You can only have one window per process.

edward9503 commented 2 years ago

nope. It's not supported.

You can only have one window per process.

Thanks for the reply.

Ok, then can I attach the cameraMan view in one process moving together with the camera frame on the robot? And how?

Thanks in advance.

jhwangbo commented 2 years ago

You can assign a dummy joint in the URDF and read it as a frame in raisim. It will give you the position and orientation. Then you have to update the pose of the camera in every frame.

edward9503 commented 2 years ago

You can assign a dummy joint in the URDF and read it as a frame in raisim. It will give you the position and orientation. Then you have to update the pose of the camera in every frame.

Really appreciate for the reply.

Yes that was exactly what I was doing. The followings are my codes:

// lambda function for the controller auto controller = [vis, anymal]() { raisim::Vec<3> camera_position; raisim::Mat<3, 3> camera_orientation; Ogre::SceneNode* mCamera; anymal.back()->getFramePosition("depth_camera_front_camera", camera_position); anymal.back()->getFrameOrientation("depth_camera_front_camera", camera_orientation); mCamera->setPosition(Ogre::Vector3(camera_position)); mCamera->setOrientation(Ogre::Quaternion{1.,0.,0.,0.}); // vis->getCameraMan()->setYawPitchDist(Ogre::Radian(0), -Ogre::Radian(M_PI_4), 2); vis->getCameraMan()->setCamera(mCamera); };

vis->setControlCallback(controller);

I realize that there are issues on the mCamera->setPosition and mCamera->setOrientation lines. But I cannot solve the problems. How is your opinion?

Thanks.

jhwangbo commented 2 years ago

Ogre must have a different convention. Check OgreVis.cpp and see how I converted it