Revision: 6338
http://playerstage.svn.sourceforge.net/playerstage/?rev=6338&view=rev
Author: natepak
Date: 2008-04-16 10:24:32 -0700 (Wed, 16 Apr 2008)
Log Message:
-----------
Added masks for displaying laser data
Modified Paths:
--------------
code/gazebo/trunk/libgazebo/gazebo.h
code/gazebo/trunk/server/Global.hh
code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
code/gazebo/trunk/server/physics/RayGeom.cc
code/gazebo/trunk/server/rendering/OgreVisual.cc
code/gazebo/trunk/server/sensors/camera/CameraSensor.cc
code/gazebo/trunk/server/sensors/camera/CameraSensor.hh
Modified: code/gazebo/trunk/libgazebo/gazebo.h
===================================================================
--- code/gazebo/trunk/libgazebo/gazebo.h 2008-04-16 17:24:18 UTC (rev
6337)
+++ code/gazebo/trunk/libgazebo/gazebo.h 2008-04-16 17:24:32 UTC (rev
6338)
@@ -1342,6 +1342,12 @@
/// Height of image in pixels
public: unsigned int height;
+ /// Far clip distance in meters
+ public: float farClip;
+
+ /// Near clip distance in meters
+ public: float nearClip;
+
/// Left image size
public: unsigned int left_rgb_size;
Modified: code/gazebo/trunk/server/Global.hh
===================================================================
--- code/gazebo/trunk/server/Global.hh 2008-04-16 17:24:18 UTC (rev 6337)
+++ code/gazebo/trunk/server/Global.hh 2008-04-16 17:24:32 UTC (rev 6338)
@@ -62,7 +62,6 @@
#define GZ_ALL_CAMERA 0xFFFFFFFF
#define GZ_LASER_CAMERA 0x00000001
-#define GZ_GUIDATA_CAMERA 0x00000002
#endif
Modified: code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
===================================================================
--- code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
2008-04-16 17:24:18 UTC (rev 6337)
+++ code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
2008-04-16 17:24:32 UTC (rev 6338)
@@ -100,9 +100,15 @@
this->cameraIface->Post();
}
- /*if (this->stereoIface && this->stereoIface->GetOpenCount() > 0)
- this->PutStereoData();
- */
+ if (this->stereoIface)
+ {
+ this->stereoIface->Lock(1);
+ if (this->stereoIface->data->head.openCount > 0)
+ this->PutStereoData();
+ this->stereoIface->Unlock();
+
+ this->stereoIface->Post();
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -122,13 +128,13 @@
const float *disp_src;
float *disp_dst;
- this->stereoIface->Lock(1);
-
// Data timestamp
stereo_data->head.time = Simulator::Instance()->GetSimTime();
stereo_data->width = this->myParent->GetImageWidth();
stereo_data->height = this->myParent->GetImageHeight();
+ stereo_data->farClip = this->myParent->GetFarClip();
+ stereo_data->nearClip = this->myParent->GetNearClip();
//stereo_data->right_rgb_size = stereo_data->width * stereo_data->height * 3;
//stereo_data->left_rgb_size = stereo_data->width * stereo_data->height * 3;
@@ -164,8 +170,6 @@
disp_dst = stereo_data->right_disparity;
memcpy(disp_dst, disp_src, stereo_data->right_disparity_size);
- this->stereoIface->Unlock();
- this->stereoIface->Post();
}
////////////////////////////////////////////////////////////////////////////////
Modified: code/gazebo/trunk/server/physics/RayGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/RayGeom.cc 2008-04-16 17:24:18 UTC (rev
6337)
+++ code/gazebo/trunk/server/physics/RayGeom.cc 2008-04-16 17:24:32 UTC (rev
6338)
@@ -31,6 +31,7 @@
#include "OgreVisual.hh"
#include "OgreDynamicLines.hh"
#include "Body.hh"
+#include "Global.hh"
#include "RayGeom.hh"
using namespace gazebo;
@@ -57,6 +58,7 @@
this->visualNode->AttachObject(this->line);
this->line->setMaterial("Gazebo/BlueEmissive");
+ this->line->setVisibilityFlags(GZ_LASER_CAMERA);
}
this->contactLen = DBL_MAX;
Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc 2008-04-16 17:24:18 UTC
(rev 6337)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc 2008-04-16 17:24:32 UTC
(rev 6338)
@@ -24,6 +24,7 @@
* SVN: $Id:$
*/
#include <Ogre.h>
+#include "Global.hh"
#include "GazeboMessage.hh"
#include "GazeboError.hh"
#include "XMLConfig.hh"
@@ -99,6 +100,8 @@
if (obj)
this->AttachObject(obj);
+ obj->setVisibilityFlags(GZ_ALL_CAMERA);
+
// Set the pose of the scene node
this->SetPose(pose);
Modified: code/gazebo/trunk/server/sensors/camera/CameraSensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/camera/CameraSensor.cc 2008-04-16
17:24:18 UTC (rev 6337)
+++ code/gazebo/trunk/server/sensors/camera/CameraSensor.cc 2008-04-16
17:24:32 UTC (rev 6338)
@@ -80,6 +80,13 @@
this->hfov = DTOR(node->GetDouble("hfov",60,0));
+ this->visibilityMask = GZ_ALL_CAMERA;
+
+ if (node->GetString("mask","none",0) == "laser")
+ {
+ this->visibilityMask ^= GZ_LASER_CAMERA;
+ }
+
// Create the directory to store frames
if (this->saveFrames)
{
@@ -114,6 +121,8 @@
this->pitchNode->pitch(Ogre::Degree(0));
this->pitchNode->attachObject(this->camera);
+ this->camera->getViewport()->setVisibilityMask(this->visibilityMask);
+
this->saveCount = 0;
}
@@ -247,4 +256,16 @@
return this->camera;
}
+////////////////////////////////////////////////////////////////////////////////
+/// Get the near clip distance
+double CameraSensor::GetNearClip()
+{
+ return this->nearClip;
+}
+////////////////////////////////////////////////////////////////////////////////
+/// Get the far clip distance
+double CameraSensor::GetFarClip()
+{
+ return this->farClip;
+}
Modified: code/gazebo/trunk/server/sensors/camera/CameraSensor.hh
===================================================================
--- code/gazebo/trunk/server/sensors/camera/CameraSensor.hh 2008-04-16
17:24:18 UTC (rev 6337)
+++ code/gazebo/trunk/server/sensors/camera/CameraSensor.hh 2008-04-16
17:24:32 UTC (rev 6338)
@@ -121,6 +121,12 @@
/// is @e not the same as the depth value.
public: double GetZValue(int x, int y);
+ /// \brief Get the near clip distance
+ public: double GetNearClip();
+
+ /// \brief Get the far clip distance
+ public: double GetFarClip();
+
/// \brief Enable or disable saving
public: void EnableSaveFrame(bool enable);
@@ -151,6 +157,8 @@
protected: unsigned int saveCount;
protected: bool saveFrames;
protected: std::string savePathname;
+
+ protected: unsigned int visibilityMask;
};
/// \}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit