osrf / gzweb

Web client for Gazebo classic simulation
http://gazebosim.org/gzweb
Other
62 stars 60 forks source link

Configurable cameraview init pose #66

Open osrf-migration opened 9 years ago

osrf-migration commented 9 years ago

Original report (archived issue) by Isaac Saito (Bitbucket: 130s).


In .world file we can define the cameraview's init pose like this, which Gzweb 1.2.0 seems to be ignoring for me.

     </scene>
+    <gui>
+     <camera name="camera_world_main">
+       <pose>57 15 1 0 0.05 1.4</pose>
+     </camera>
+    </gui>
   </world>

Manually chaging gzweb/http/client/gz3d.js like below works.

  // camera
  this.camera = new THREE.PerspectiveCamera(
      60, window.innerWidth / window.innerHeight, 0.1, 1000 );
- this.defaultCameraPosition = new THREE.Vector3(0, -5, 5);
+ this.defaultCameraPosition = new THREE.Vector3(57, 15, 1);
  this.resetView();
GZ3D.Scene.prototype.resetView = function()
{
  this.camera.position.copy(this.defaultCameraPosition);
  this.camera.up = new THREE.Vector3(0, 0, 1);
- this.camera.lookAt(new THREE.Vector3( 0, 0, 0 ));
+ this.camera.lookAt(new THREE.Vector3( 62, 22, 0 ));
  this.camera.updateMatrix();
};

Still, this resetView isn't effective when the web page is reloaded. Pressing Reset View button on Gzweb works.

So in summary, issues I'm seeing:

1) camera tag in SDF is ignored. 2) resetView in gzweb/http/client/gz3d.js does not work when the Gzweb web page is loaded.

osrf-migration commented 8 years ago

Original comment by Kei Okada (Bitbucket: k-okada).


if I understand correctly, there is no way for gzweb to get initial camera pose http://gazebosim.org/tutorials/?tut=ros_comm

k-okada@kokada-t440s:~$ gztopic list
/gazebo/default/pose/local/info
/gazebo/default/pose/info
/gazebo/default/gui
/gazebo/default/response
/gazebo/default/world_stats
/gazebo/default/selection
/gazebo/default/model/info
/gazebo/default/light
/gazebo/default/physics/contacts
/gazebo/default/visual
/gazebo/default/request
/gazebo/default/joint
/gazebo/default/factory
/gazebo/world/modify
/gazebo/default/model/modify
/gazebo/default/scene
/gazebo/default/physics
/gazebo/default/world_control
/gazebo/server/control
/gazebo/default/diagnostics
/gazebo/default/log/status

Am I correct?

osrf-migration commented 5 years ago

Original comment by Ansar Khan (Bitbucket: Ansar Khan).


Looks like this is some sort of race condition which resets the camera position to zero in the init; even though resetView() is called. Current work around for this would be adding this.resetView(); at the end of the GZ3D.Scene.prototype.init method (approx line 5562) in gz3d.js

osrf-migration commented 5 years ago

Original comment by Ansar Khan (Bitbucket: Ansar Khan).


Kei Okada (k-okada) Yes, the initial camera pose from the launch file is used by gzclient but gzweb takes its initial camera parameters in the GZ3D.Scene.prototype.initmethod which are currently hard coded to be: this.defaultCameraPosition = new THREE.Vector3(0, -5, 5);`