From: <na...@us...> - 2008-06-26 14:04:09
|
Revision: 6696 http://playerstage.svn.sourceforge.net/playerstage/?rev=6696&view=rev Author: natepak Date: 2008-06-26 14:04:18 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Fixed camera masking, and fixed generic_camera controller Modified Paths: -------------- code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.hh code/gazebo/trunk/server/rendering/OgreCamera.cc code/gazebo/trunk/server/rendering/UserCamera.cc code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc code/gazebo/trunk/worlds/models/sonyvid30.model code/gazebo/trunk/worlds/pioneer2dx_gripper.world Modified: code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc =================================================================== --- code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc 2008-06-26 21:04:18 UTC (rev 6696) @@ -35,7 +35,7 @@ #include "gazebo.h" #include "GazeboError.hh" #include "ControllerFactory.hh" -#include "OgreCamera.hh" +#include "MonoCameraSensor.hh" #include "Generic_Camera.hh" using namespace gazebo; @@ -47,7 +47,7 @@ Generic_Camera::Generic_Camera(Entity *parent) : Controller(parent) { - this->myParent = dynamic_cast<OgreCamera*>(this->parent); + this->myParent = dynamic_cast<MonoCameraSensor*>(this->parent); if (!this->myParent) gzthrow("Generic_Camera controller requires a Camera Sensor as its parent"); @@ -123,22 +123,11 @@ assert (data->image_size <= sizeof(data->image)); // Copy the pixel data to the interface - //src = this->myParent->GetImageData(); + src = this->myParent->GetImageData(0); dst = data->image; memcpy(dst, src, data->image_size); - - //unsigned int i, j, k; - // OGRE image data is A8 B8 G8 R8. Must convert to R8 G8 B8 - /* for (i=0; i<data->height; i++) - for (j=0; j<data->width; j++) - for (k=2; k>=0; k--) - memcpy(dst + i*data->width*3 + j*3 + 2-k, - src + i*data->width*4 + j*4 + k, - 1); - */ - this->cameraIface->Unlock(); // New data is available Modified: code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.hh =================================================================== --- code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.hh 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.hh 2008-06-26 21:04:18 UTC (rev 6696) @@ -34,7 +34,7 @@ namespace gazebo { class CameraIface; - class OgreCamera; + class MonoCameraSensor; /// @addtogroup gazebo_controller /// @{ @@ -97,7 +97,7 @@ private: CameraIface *cameraIface; /// The parent sensor - private: OgreCamera *myParent; + private: MonoCameraSensor *myParent; }; Modified: code/gazebo/trunk/server/rendering/OgreCamera.cc =================================================================== --- code/gazebo/trunk/server/rendering/OgreCamera.cc 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/rendering/OgreCamera.cc 2008-06-26 21:04:18 UTC (rev 6696) @@ -132,7 +132,6 @@ // Initialize the camera void OgreCamera::InitCam() { - this->camera = OgreCreator::CreateCamera(this->cameraName, this->nearClip, this->farClip, this->hfov, this->renderTarget ); // Create a scene node to control pitch motion @@ -142,7 +141,6 @@ this->saveCount = 0; - //this->camera->getViewport()->setVisibilityMask(this->visibilityMask); } ////////////////////////////////////////////////////////////////////////////// @@ -155,6 +153,7 @@ // Update the drawing void OgreCamera::UpdateCam() { + if (World::Instance()->GetWireframe()) { this->camera->setPolygonMode(Ogre::PM_WIREFRAME); Modified: code/gazebo/trunk/server/rendering/UserCamera.cc =================================================================== --- code/gazebo/trunk/server/rendering/UserCamera.cc 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/rendering/UserCamera.cc 2008-06-26 21:04:18 UTC (rev 6696) @@ -74,7 +74,7 @@ this->SetAspectRatio( Ogre::Real(this->viewport->getActualWidth()) / Ogre::Real(this->viewport->getActualHeight()) ); - //this->viewport->setVisibilityMask(this->visibilityMask); + this->viewport->setVisibilityMask(this->visibilityMask); } //////////////////////////////////////////////////////////////////////////////// Modified: code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc =================================================================== --- code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-06-26 21:04:18 UTC (rev 6696) @@ -124,25 +124,6 @@ this->renderTarget->update(); - if (this->saveFrames) - this->SaveFrame(); -} - -//////////////////////////////////////////////////////////////////////////////// -// Return the material the camera renders to -std::string MonoCameraSensor::GetMaterialName() const -{ - return this->ogreMaterialName; -} - - -////////////////////////////////////////////////////////////////////////////// -/// Get a pointer to the image data -const unsigned char *MonoCameraSensor::GetImageData(unsigned int i) -{ - if (i!=0) - gzerr(0) << "Camera index must be zero for mono cam"; - Ogre::HardwarePixelBufferSharedPtr mBuffer; size_t size; @@ -176,6 +157,26 @@ mBuffer->unlock(); + + if (this->saveFrames) + this->SaveFrame(); +} + +//////////////////////////////////////////////////////////////////////////////// +// Return the material the camera renders to +std::string MonoCameraSensor::GetMaterialName() const +{ + return this->ogreMaterialName; +} + + +////////////////////////////////////////////////////////////////////////////// +/// Get a pointer to the image data +const unsigned char *MonoCameraSensor::GetImageData(unsigned int i) +{ + if (i!=0) + gzerr(0) << "Camera index must be zero for mono cam"; + return this->saveFrameBuffer; } Modified: code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc =================================================================== --- code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-06-26 21:04:18 UTC (rev 6696) @@ -139,6 +139,7 @@ cviewport->setClearEveryFrame(true); cviewport->setOverlaysEnabled(false); cviewport->setBackgroundColour( *OgreAdaptor::Instance()->backgroundColor ); + cviewport->setVisibilityMask(this->visibilityMask); } // Create materials for all the render textures. Modified: code/gazebo/trunk/worlds/models/sonyvid30.model =================================================================== --- code/gazebo/trunk/worlds/models/sonyvid30.model 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/worlds/models/sonyvid30.model 2008-06-26 21:04:18 UTC (rev 6696) @@ -96,6 +96,10 @@ <farClip>100</farClip> <saveFrames>true</saveFrames> <saveFramePath>frames</saveFramePath> + + <controller:generic_camera name="sonyvid30_camera_controller"> + <interface:camera name="camera_iface_0"/> + </controller:generic_camera> </sensor:camera> </body:box> Modified: code/gazebo/trunk/worlds/pioneer2dx_gripper.world =================================================================== --- code/gazebo/trunk/worlds/pioneer2dx_gripper.world 2008-06-26 20:33:09 UTC (rev 6695) +++ code/gazebo/trunk/worlds/pioneer2dx_gripper.world 2008-06-26 21:04:18 UTC (rev 6696) @@ -93,19 +93,6 @@ </include> </model:physical> - <model:physical name="laser"> - <xyz>0.15 0 0.18</xyz> - - <attach> - <parentBody>chassis_body</parentBody> - <myBody>laser_body</myBody> - </attach> - - <include embedded="true"> - <xi:include href="models/sicklms200.model" /> - </include> - </model:physical> - <!-- The include should be last within a model. All previous statements will override those in the included file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |