Revision: 6759
http://playerstage.svn.sourceforge.net/playerstage/?rev=6759&view=rev
Author: alexcb
Date: 2008-07-04 11:18:25 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
fixed stall icon positioning for perspective camera mode
Modified Paths:
--------------
code/stage/trunk/CMakeLists.txt
code/stage/trunk/libstage/camera.cc
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/model_camera.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/worlds/everything.world
code/stage/trunk/worlds/fasr.world
code/stage/trunk/worlds/pantilt.inc
code/stage/trunk/worlds/swarmbenchmark/cave.world
Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/CMakeLists.txt 2008-07-04 18:18:25 UTC (rev 6759)
@@ -80,6 +80,7 @@
include_directories( .
libstage
replace
+ /opt/local/include/
${GLIB_INCLUDE_DIRS}
${LIBPNG_INCLUDE_DIRS}
${CMAKE_INCLUDE_PATH}
Modified: code/stage/trunk/libstage/camera.cc
===================================================================
--- code/stage/trunk/libstage/camera.cc 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/libstage/camera.cc 2008-07-04 18:18:25 UTC (rev 6759)
@@ -14,8 +14,9 @@
//perspective camera
//perspective camera
StgPerspectiveCamera::StgPerspectiveCamera( void ) :
- _x( 0 ), _y( 0 ), _z( 0 ), _pitch( 90 ), _yaw( 0 ), _z_near(
0.2 ), _z_far( 40.0 ), _vert_fov( 40 ), _horiz_fov( 60 ), _aspect( 1.0 )
+ _z_near( 0.2 ), _z_far( 40.0 ), _vert_fov( 40 ), _horiz_fov( 60
), _aspect( 1.0 )
{
+ setYaw( 90 );
}
void StgPerspectiveCamera::move( float x, float y, float z )
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/libstage/canvas.cc 2008-07-04 18:18:25 UTC (rev 6759)
@@ -65,6 +65,7 @@
perspective_camera.setPose( -3.0, 0.0, 1.0 );
perspective_camera.setPitch( 70.0 ); //look down
+ current_camera = &camera;
startx = starty = 0;
//panx = pany = stheta = sphi = 0.0;
@@ -925,10 +926,12 @@
if( perspectiveCam == true ) {
perspective_camera.setAspect( static_cast< float >( w() ) /
static_cast< float >( h() ) );
perspective_camera.SetProjection();
+ current_camera = &perspective_camera;
} else {
stg_bounds3d_t extent = world->GetExtent();
camera.SetProjection( w(), h(), extent.y.min, extent.y.max );
camera.Draw();
+ current_camera = &camera;
}
// enable vertex arrays
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/libstage/model.cc 2008-07-04 18:18:25 UTC (rev 6759)
@@ -915,9 +915,17 @@
// draw speech bubble
if( say_string )
{
- float stheta = -dtor( canvas->camera.getPitch() );
- float sphi = dtor( canvas->camera.getYaw() );
+ float stheta = -dtor( canvas->current_camera->pitch() );
+ float sphi = dtor( canvas->current_camera->yaw() );
float scale = canvas->camera.getScale();
+ if( canvas->perspectiveCam == true ) {
+ sphi = atan2(
+ ( pose.x -
canvas->current_camera->x() )
+ ,
+ ( pose.y -
canvas->current_camera->y() )
+ );
+ stheta = -stheta;
+ }
glPushMatrix();
@@ -969,8 +977,16 @@
void StgModel::DrawImage( uint32_t texture_id, Stg::StgCanvas* canvas, float
alpha )
{
- float stheta = -dtor( canvas->camera.getPitch() );
- float sphi = dtor( canvas->camera.getYaw() );
+ float stheta = -dtor( canvas->current_camera->pitch() );
+ float sphi = dtor( canvas->current_camera->yaw() );
+ if( canvas->perspectiveCam == true ) {
+ sphi = atan2(
+ ( pose.x - canvas->current_camera->x() )
+ ,
+ ( pose.y - canvas->current_camera->y() )
+ );
+ stheta = -stheta;
+ }
glEnable(GL_TEXTURE_2D);
glBindTexture( GL_TEXTURE_2D, texture_id );
Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc 2008-07-04 17:44:35 UTC (rev
6758)
+++ code/stage/trunk/libstage/model_camera.cc 2008-07-04 18:18:25 UTC (rev
6759)
@@ -19,8 +19,8 @@
Option StgModelCamera::showCameraData( "Show Camera Data", "show_camera", "",
true );
-static const stg_size_t DEFAULT_SIZE = {0.15, 0.15, 0.2 };
-static const char DEFAULT_GEOM_COLOR[] = "blue";
+static const stg_size_t DEFAULT_SIZE = {0.1, 0.07, 0.05 };
+static const char DEFAULT_GEOM_COLOR[] = "black";
/**
@ingroup model
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/libstage/stage.hh 2008-07-04 18:18:25 UTC (rev 6759)
@@ -1781,12 +1781,24 @@
class StgCamera
{
+ protected:
+ float _pitch; //left-right (about y)
+ float _yaw; //up-down (about x)
+ float _x, _y, _z;
+
public:
- StgCamera() { }
+ StgCamera() : _pitch( 0 ), _yaw( 0 ), _x( 0 ), _y( 0 ), _z( 0 )
{ }
virtual ~StgCamera() { }
virtual void Draw( void ) const = 0;
+ inline float yaw( void ) const { return _yaw; }
+ inline float pitch( void ) const { return _pitch; }
+
+ inline float x( void ) const { return _x; }
+ inline float y( void ) const { return _y; }
+ inline float z( void ) const { return _z; }
+
//TODO data should be passed in somehow else. (at least min/max
stuff)
//virtual void SetProjection( float pixels_width, float
pixels_height, float y_min, float y_max ) const = 0;
};
@@ -1794,9 +1806,6 @@
class StgPerspectiveCamera : public StgCamera
{
private:
- float _x, _y, _z;
- float _pitch; //left-right (about y)
- float _yaw; //up-down (about x)
float _z_near;
float _z_far;
@@ -1826,8 +1835,6 @@
_aspect = aspect;
}
inline void setYaw( float yaw ) { _yaw = yaw; }
- inline float yaw( void ) const { return _yaw; }
- inline float pitch( void ) const { return _pitch; }
inline float horizFov( void ) const { return _horiz_fov; }
inline float vertFov( void ) const { return _vert_fov; }
inline void addYaw( float yaw ) { _yaw += yaw; }
@@ -1848,13 +1855,10 @@
class StgOrthoCamera : public StgCamera
{
private:
- float _x, _y, _z;
- float _pitch; //left-right (about y)
- float _yaw; //up-down (about x)
float _scale;
public:
- StgOrthoCamera( void ) : _x( 0 ), _y( 0 ), _z( 0 ), _pitch( 0
), _yaw( 0 ), _scale( 15 ) { }
+ StgOrthoCamera( void ) : _scale( 15 ) { }
virtual void Draw() const;
virtual void SetProjection( float pixels_width, float
pixels_height, float y_min, float y_max ) const;
@@ -1913,6 +1917,7 @@
private:
GlColorStack colorstack;
+ StgCamera* current_camera;
StgOrthoCamera camera;
StgPerspectiveCamera perspective_camera;
Modified: code/stage/trunk/worlds/everything.world
===================================================================
--- code/stage/trunk/worlds/everything.world 2008-07-04 17:44:35 UTC (rev
6758)
+++ code/stage/trunk/worlds/everything.world 2008-07-04 18:18:25 UTC (rev
6759)
@@ -64,7 +64,6 @@
)
)
- camera( alwayson 1 )
fiducial_return 17
gripper_return 0
@@ -94,8 +93,11 @@
trickedoutpioneer
(
color "red"
- name "redrobot"
+ name "redrobot_w_camera"
pose [-5.645 3.034 -162.098]
+ camera( alwayson 1
+
+ )
)
trickedoutpioneer
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/worlds/fasr.world 2008-07-04 18:18:25 UTC (rev 6759)
@@ -21,10 +21,10 @@
# configure the GUI window
window
(
- size [ 1641.000 953.000 ]
- center [0.265 0.145]
- rotate [ -57.500 -29.500 ]
- scale 62.271
+ size [ 833.000 605.000 ]
+ center [0.000 0.000]
+ rotate [ -47.500 -12.500 ]
+ scale 32.344
show_data 0
show_flags 1
@@ -59,15 +59,17 @@
(
color "red"
- sicklaser( pose [ 0.040 0.000 0.000 ] samples 30 range_max 5 laser_return 2 )
- camera( pose [ 0.000 0.000 0.000 ] width 100 height 100 horizfov 70 vertfov
40 yaw 0 )
+ sicklaser( pose [ 0.040 0.000 0.000 ] samples 30 range_max 5 laser_return 2
+
+ camera( pose [ 0.000 0.000 0.000 ] width 100 height 100 horizfov 70 vertfov
40 yaw 0 )
+ )
ctrl "fasr"
- # say "Autolab"
+# say "Autolab"
)
-autorob( pose [4.461 6.406 1.930] )
+autorob( pose [1.633 4.021 1.930] )
#autorob( pose [6.635 6.458 -52.629] )
#autorob( pose [6.385 5.805 -87.082] )
#autorob( pose [7.004 5.327 170.536] )
Modified: code/stage/trunk/worlds/pantilt.inc
===================================================================
--- code/stage/trunk/worlds/pantilt.inc 2008-07-04 17:44:35 UTC (rev 6758)
+++ code/stage/trunk/worlds/pantilt.inc 2008-07-04 18:18:25 UTC (rev 6759)
@@ -17,6 +17,17 @@
)
#TODO make a fancier model
-#define fancypantiltcamer pantiltcamera
-#(
-#)
+define fancypantiltcamer pantiltcamera
+(
+ blocks 1
+
+ # bottom
+ block[0].points 4
+ block[0].point[0] [ -2.1 0.07 ]
+ block[0].point[1] [ -2.1 -0.07 ]
+ block[0].point[2] [ 2.1 -0.07 ]
+ block[0].point[3] [ 2.1 0.07 ]
+ block[0].z [0 0.2 ]
+
+
+)
Modified: code/stage/trunk/worlds/swarmbenchmark/cave.world
===================================================================
--- code/stage/trunk/worlds/swarmbenchmark/cave.world 2008-07-04 17:44:35 UTC
(rev 6758)
+++ code/stage/trunk/worlds/swarmbenchmark/cave.world 2008-07-04 18:18:25 UTC
(rev 6759)
@@ -17,7 +17,7 @@
(
size [ 1000.000 1000.000 ]
center [-0.932 -0.088]
- rotate [ 0.000 0.000 ]
+ rotate [ -61.500 -50.000 ]
scale 51.828
)
@@ -48,114 +48,114 @@
define goldrob rob( color "gold" )
define darkredrob rob( color "DarkRed" )
-redrob( pose [-5.285 4.915 158.268] )
-redrob( pose [-4.464 5.679 -52.629] )
-redrob( pose [-5.518 4.157 22.445] )
-redrob( pose [-6.007 5.008 156.191] )
-redrob( pose [-5.559 3.371 -109.062] )
-redrob( pose [-6.932 3.655 89.455] )
-redrob( pose [-7.521 4.062 -164.935] )
-redrob( pose [-4.377 4.901 -103.425] )
-redrob( pose [-6.277 4.252 -57.759] )
-redrob( pose [-5.216 5.750 -57.823] )
+redrob( pose [-5.285 4.915 150.459] )
+redrob( pose [-4.432 5.655 -85.494] )
+redrob( pose [-5.518 4.157 -10.236] )
+redrob( pose [-6.007 5.008 144.441] )
+redrob( pose [-5.599 3.365 -172.038] )
+redrob( pose [-6.852 3.655 4.679] )
+redrob( pose [-7.483 4.049 -12.199] )
+redrob( pose [-4.393 4.938 114.269] )
+redrob( pose [-6.277 4.252 -97.494] )
+redrob( pose [-5.202 5.566 -89.743] )
-bluerob( pose [-6.984 6.565 -113.456] )
-bluerob( pose [-6.243 5.709 -1.177] )
-bluerob( pose [-6.382 6.320 46.585] )
-bluerob( pose [-7.527 6.162 135.162] )
-bluerob( pose [-6.973 5.568 -3.588] )
-bluerob( pose [-7.611 6.835 93.535] )
-bluerob( pose [-7.601 5.135 -35.760] )
-bluerob( pose [-6.983 4.818 -17.538] )
-bluerob( pose [-7.415 7.485 -23.903] )
-bluerob( pose [-6.738 7.157 -17.092] )
+bluerob( pose [-7.014 6.409 -103.088] )
+bluerob( pose [-6.139 5.649 -29.509] )
+bluerob( pose [-6.315 6.277 -35.740] )
+bluerob( pose [-7.527 6.162 -18.380] )
+bluerob( pose [-6.897 5.544 -2.394] )
+bluerob( pose [-7.535 6.860 11.282] )
+bluerob( pose [-7.332 5.061 -0.348] )
+bluerob( pose [-6.810 4.727 -41.884] )
+bluerob( pose [-7.415 7.485 -14.803] )
+bluerob( pose [-6.722 7.120 -70.950] )
-greenrob( pose [-2.693 6.699 -97.306] )
-greenrob( pose [-3.304 5.100 2.962] )
-greenrob( pose [-2.477 6.075 -120.224] )
-greenrob( pose [-3.507 5.901 -82.019] )
-greenrob( pose [-2.462 7.492 -143.143] )
-greenrob( pose [-1.908 6.870 -5.633] )
-greenrob( pose [-1.583 6.080 -95.405] )
-greenrob( pose [-0.600 7.526 0.097] )
-greenrob( pose [-0.563 6.815 -52.433] )
-greenrob( pose [-1.367 7.506 163.390] )
+greenrob( pose [-2.686 6.660 -20.602] )
+greenrob( pose [-3.274 5.174 63.058] )
+greenrob( pose [-2.477 6.075 -93.720] )
+greenrob( pose [-3.473 5.829 -57.467] )
+greenrob( pose [-2.462 7.492 -65.482] )
+greenrob( pose [-1.836 6.835 -59.739] )
+greenrob( pose [-1.654 6.043 -171.672] )
+greenrob( pose [-0.519 7.392 -67.052] )
+greenrob( pose [-0.563 6.815 -106.072] )
+greenrob( pose [-1.404 7.436 -110.338] )
-magentarob( pose [1.702 7.364 -37.146] )
-magentarob( pose [2.628 6.716 -88.712] )
-magentarob( pose [2.686 5.754 -17.092] )
-magentarob( pose [3.723 7.426 160.525] )
-magentarob( pose [2.625 7.473 108.959] )
-magentarob( pose [3.460 6.754 -24.723] )
-magentarob( pose [3.418 5.967 -85.847] )
-magentarob( pose [0.349 7.510 0.097] )
-magentarob( pose [1.769 6.270 -17.092] )
-magentarob( pose [0.561 6.752 -27.588] )
+magentarob( pose [1.731 7.249 -92.107] )
+magentarob( pose [2.586 6.521 -100.329] )
+magentarob( pose [3.001 5.447 -46.977] )
+magentarob( pose [3.611 7.214 -116.841] )
+magentarob( pose [2.625 7.473 -48.982] )
+magentarob( pose [3.660 6.559 -74.307] )
+magentarob( pose [3.434 5.808 -83.857] )
+magentarob( pose [0.624 7.277 -40.753] )
+magentarob( pose [2.017 6.083 -52.575] )
+magentarob( pose [0.561 6.752 4.367] )
-yellowrob( pose [-7.548 3.117 150.967] )
-yellowrob( pose [-6.811 2.501 108.959] )
-yellowrob( pose [-7.632 2.151 -85.847] )
-yellowrob( pose [-7.089 1.777 153.832] )
-yellowrob( pose [-6.317 3.246 -140.278] )
-yellowrob( pose [-6.323 1.862 179.615] )
-yellowrob( pose [-5.979 2.590 -54.334] )
-yellowrob( pose [-5.358 1.495 -62.929] )
-yellowrob( pose [-5.279 2.419 0.097] )
-yellowrob( pose [-4.685 1.709 -62.929] )
+yellowrob( pose [-7.548 3.117 12.515] )
+yellowrob( pose [-6.811 2.501 83.166] )
+yellowrob( pose [-7.475 2.119 -0.137] )
+yellowrob( pose [-7.052 1.708 -48.147] )
+yellowrob( pose [-6.352 3.226 -146.472] )
+yellowrob( pose [-6.323 1.862 -155.344] )
+yellowrob( pose [-5.966 2.552 -75.391] )
+yellowrob( pose [-5.358 1.495 -128.137] )
+yellowrob( pose [-5.279 2.419 32.326] )
+yellowrob( pose [-4.698 1.671 -113.009] )
-goldrob( pose [5.734 7.537 -32.379] )
-goldrob( pose [7.335 7.494 63.122] )
-goldrob( pose [6.403 6.182 -19.957] )
-goldrob( pose [7.441 6.661 -88.712] )
-goldrob( pose [5.541 6.778 156.697] )
-goldrob( pose [6.593 6.929 162.426] )
-goldrob( pose [4.757 7.353 -17.092] )
-goldrob( pose [5.228 6.159 -17.092] )
-goldrob( pose [4.738 6.752 -17.092] )
-goldrob( pose [4.217 6.192 -17.092] )
+goldrob( pose [5.834 7.276 -74.706] )
+goldrob( pose [7.335 7.494 -146.899] )
+goldrob( pose [6.407 5.942 -91.539] )
+goldrob( pose [7.258 6.175 -116.576] )
+goldrob( pose [5.541 6.778 -92.857] )
+goldrob( pose [6.564 6.902 -120.722] )
+goldrob( pose [4.799 7.285 -75.638] )
+goldrob( pose [5.271 6.005 -74.373] )
+goldrob( pose [4.769 6.595 -86.730] )
+goldrob( pose [4.340 5.941 -65.977] )
-darkredrob( pose [-7.630 0.425 -45.740] )
-darkredrob( pose [-7.571 1.112 -74.388] )
-darkredrob( pose [-6.158 1.168 177.714] )
-darkredrob( pose [-4.509 0.635 24.916] )
-darkredrob( pose [-7.625 -0.265 68.852] )
-darkredrob( pose [-6.805 0.167 23.015] )
-darkredrob( pose [-6.897 0.859 -51.469] )
-darkredrob( pose [-6.055 0.262 25.880] )
-darkredrob( pose [-5.195 0.771 -33.318] )
-darkredrob( pose [-5.483 -0.245 -17.092] )
+darkredrob( pose [-7.630 0.425 -15.747] )
+darkredrob( pose [-7.571 1.112 1.397] )
+darkredrob( pose [-6.158 1.168 32.866] )
+darkredrob( pose [-4.509 0.635 4.689] )
+darkredrob( pose [-7.549 -0.241 1.423] )
+darkredrob( pose [-6.728 0.180 -22.542] )
+darkredrob( pose [-6.824 0.826 -11.285] )
+darkredrob( pose [-6.015 0.257 -2.367] )
+darkredrob( pose [-5.195 0.771 -64.592] )
+darkredrob( pose [-5.483 -0.245 70.044] )
-cyanrob( pose [-2.544 4.684 -143.143] )
-cyanrob( pose [-0.542 3.423 32.573] )
-cyanrob( pose [-1.731 4.304 -125.954] )
-cyanrob( pose [-2.152 5.502 -94.441] )
-cyanrob( pose [-2.424 3.799 137.607] )
-cyanrob( pose [-1.440 3.502 -37.145] )
-cyanrob( pose [-2.603 2.866 130.914] )
-cyanrob( pose [-1.958 2.886 -5.633] )
-cyanrob( pose [-2.183 2.102 -3.731] )
-cyanrob( pose [-1.483 5.050 8.691] )
+cyanrob( pose [-2.544 4.684 -134.461] )
+cyanrob( pose [-0.366 3.260 -44.509] )
+cyanrob( pose [-1.760 4.277 -118.276] )
+cyanrob( pose [-2.211 5.401 -160.089] )
+cyanrob( pose [-2.281 3.871 17.255] )
+cyanrob( pose [-1.440 3.502 -67.215] )
+cyanrob( pose [-2.532 2.902 -6.938] )
+cyanrob( pose [-1.919 2.877 -13.437] )
+cyanrob( pose [-1.725 1.970 -17.763] )
+cyanrob( pose [-1.483 5.050 8.818] )
-orangerob( pose [-7.692 -2.013 129.012] )
-orangerob( pose [-6.974 -2.159 83.176] )
-orangerob( pose [-6.795 -1.320 -120.224] )
-orangerob( pose [-7.641 -0.996 74.581] )
-orangerob( pose [-6.801 -0.515 -94.441] )
-orangerob( pose [-7.611 -3.107 -103.036] )
-orangerob( pose [-6.788 -3.163 -91.577] )
-orangerob( pose [-6.028 -2.820 -105.900] )
-orangerob( pose [-6.163 -1.853 -45.740] )
-orangerob( pose [-6.026 -0.817 65.987] )
+orangerob( pose [-7.652 -2.012 -0.754] )
+orangerob( pose [-6.934 -2.155 -40.701] )
+orangerob( pose [-6.798 -1.520 -93.732] )
+orangerob( pose [-7.525 -0.994 -9.450] )
+orangerob( pose [-6.679 -0.670 -70.140] )
+orangerob( pose [-7.611 -3.107 -51.626] )
+orangerob( pose [-6.656 -3.665 -70.493] )
+orangerob( pose [-6.139 -3.326 -90.309] )
+orangerob( pose [-6.163 -1.853 -115.649] )
+orangerob( pose [-6.026 -0.817 -11.811] )
-purplerob( pose [-3.873 1.694 -97.306] )
-purplerob( pose [-2.893 1.951 -177.520] )
-purplerob( pose [-3.912 1.127 -19.957] )
-purplerob( pose [-3.152 1.184 -114.495] )
-purplerob( pose [-3.878 0.364 -88.712] )
-purplerob( pose [-3.058 0.453 -19.956] )
-purplerob( pose [-3.848 -0.468 -5.633] )
-purplerob( pose [-3.114 -0.386 -60.064] )
-purplerob( pose [-2.506 1.261 -82.982] )
-purplerob( pose [-4.611 -0.180 -17.092] )
+purplerob( pose [-3.863 1.615 -84.575] )
+purplerob( pose [-2.826 1.856 -44.148] )
+purplerob( pose [-3.889 1.094 -50.194] )
+purplerob( pose [-3.124 1.034 -72.759] )
+purplerob( pose [-3.878 0.244 -74.604] )
+purplerob( pose [-2.846 0.345 -36.704] )
+purplerob( pose [-3.651 -0.504 -8.212] )
+purplerob( pose [-2.736 -0.851 -45.703] )
+purplerob( pose [-2.477 1.234 -50.431] )
+purplerob( pose [-4.471 -0.104 26.367] )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit