AURobotServers  4
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
UPcpItem Class Reference

#include <upcpitem.h>

Inheritance diagram for UPcpItem:
Inheritance graph

Public Types

enum  POINT_CLOUD_TYPE { Empty, PointXyz, PointXyzRgb }
 
enum  SHAPE_TYPE { cloud, polygon, polyline }
 

Public Member Functions

void add (double x, double y, double z)
 
void add (double x, double y, double z, uint32_t rgb)
 
void clear ()
 
const char * codeXML (char *buf, const int bufCnt)
 
bool copy (UPcpItem *source)
 
void copy (pcl::PointCloud< pcl::PointXYZ > *source)
 
void copy (pcl::PointCloud< pcl::PointXYZRGB > *source)
 
void deleteCloud ()
 
POINT_CLOUD_TYPE getCloudType ()
 
virtual const char * getDataType ()
 
int getNeededBufferSize ()
 
UPosition getPoint (int idx)
 
int getPointsCnt ()
 
SHAPE_TYPE getShapeType ()
 
bool hasColor ()
 
bool isA (const char *thisname)
 
bool isEmpty ()
 
bool isPolygon ()
 
bool isPolyline ()
 
bool isXYZ ()
 
bool isXYZRGB ()
 
void makeCloud (POINT_CLOUD_TYPE type)
 
bool match (const char *thisname)
 
const char * print (const char *preStr, char *buff, const int buffCnt)
 
void remove (int idx)
 
bool savePCD (const char *filename)
 
void setAsCloud ()
 
void setAsPolygon ()
 
void setAsPolyline ()
 
void setName (const char *newname)
 
void setUpdated ()
 
 UPcpItem ()
 
 ~UPcpItem ()
 
- Public Member Functions inherited from UDataBase
bool isA (const char *typeString)
 
virtual bool isAlsoA (const char *typeString)
 
virtual void snprint (const char *preString, char *buff, const int buffCnt)
 
 UDataBase ()
 
virtual ~UDataBase ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 

Public Attributes

POINT_CLOUD_TYPE cloudType
 
int cooSys
 
char name [MNL]
 
UPosRot relPose
 
bool relPoseUse
 
UTime sensorTime
 
SHAPE_TYPE shapeType
 
UTime updateTime
 
pcl::PointCloud< pcl::PointXYZ > * xyz
 XYZ point cloud (maintained by the pool) More...
 
pcl::PointCloud< pcl::PointXYZ >::Ptr * xyzp
 pointer to xyz cloud (maintained by the pool) More...
 
pcl::PointCloud< pcl::PointXYZRGB > * xyzrgb
 XYZRGB cloud. More...
 
pcl::PointCloud< pcl::PointXYZRGB >::Ptr * xyzrgbp
 pointer to xyzcloud More...
 

Static Public Attributes

static const int MNL = 32
 

Detailed Description

A point cloud iten that can hold a XYZ or a XYZRGB point cloud. In addition there is info about the detection time, the coordinate system (and sensor pose on robot - if relevant). The structure should be locked when reading or writing more than one field, to ensure consistent data.

Member Enumeration Documentation

shape type, Empty, PointXyz or PointXyzRgb

Enumerator
Empty 
PointXyz 
PointXyzRgb 

shape type, cloud, polygon or polyline

Enumerator
cloud 
polygon 
polyline 

Constructor & Destructor Documentation

UPcpItem::UPcpItem ( )
inline
UPcpItem::~UPcpItem ( )
inline

Destructor

References buf, codeXML(), isA(), match(), print(), and setName().

Member Function Documentation

void UPcpItem::add ( double  x,
double  y,
double  z 
)
inline

Add this point to the pointcloud

References xyz.

Referenced by UResPcp::add(), UResPcp::getItemXYZ(), UResPcp::handleNewData(), UResPcp::methodCall(), and UResPcp::methodCallV().

void UPcpItem::add ( double  x,
double  y,
double  z,
uint32_t  rgb 
)
inline

Add this point to the pointcloud

References xyz, and xyzrgb.

void UPcpItem::clear ( void  )
inline

Clear all points in this point cloud, but maintain name and type

References cloudType, PointXyz, PointXyzRgb, savePCD(), xyz, and xyzrgb.

Referenced by UResPcp::add(), UResPcp::del(), and UResPcp::handleNewData().

const char * UPcpItem::codeXML ( char *  buf,
const int  bufCnt 
)

code this pcp item in XML format

Parameters
buffstart of buffer
bufCntlength of buffer
Returns
a pointer to the buffer

References bool2str(), buf, cooSys, UTime::getMicrosec(), getNeededBufferSize(), getPointsCnt(), UTime::getSec(), isXYZRGB(), URotation::Kappa, name, URotation::Omega, URotation::Phi, relPose, relPoseUse, sensorTime, UPosition::x, xyz, xyzrgb, UPosition::y, and UPosition::z.

Referenced by UResPcp::codePcpXml(), and ~UPcpItem().

bool UPcpItem::copy ( UPcpItem source)
void UPcpItem::copy ( pcl::PointCloud< pcl::PointXYZ > *  source)

Copy source cloud to this cloud

References makeCloud(), PointXyz, and xyz.

void UPcpItem::copy ( pcl::PointCloud< pcl::PointXYZRGB > *  source)

Copy source cloud to this cloud

References makeCloud(), PointXyzRgb, and xyzrgb.

void UPcpItem::deleteCloud ( )
inline

delete point cloud

References cloudType, Empty, xyz, xyzp, xyzrgb, and xyzrgbp.

Referenced by UResPcp::add(), and makeCloud().

POINT_CLOUD_TYPE UPcpItem::getCloudType ( )
inline

Get cloud type (either cloud, a po

References cloudType.

Referenced by UResPcp::add(), copy(), and UPaintPcp::paint().

virtual const char* UPcpItem::getDataType ( )
inlinevirtual

get data type for for this transferable class

Reimplemented from UDataBase.

int UPcpItem::getNeededBufferSize ( )
inline

Get needed buffer size to code cloud in ASCII

References getPointsCnt(), and isXYZ().

Referenced by codeXML(), and UFuncPcp::handleCommand().

UPosition UPcpItem::getPoint ( int  idx)
inline

get point position in UPosition type

Returns
all zeros if not a valid index

References getPointsCnt(), isXYZ(), UPosition::x, xyz, xyzrgb, UPosition::y, and UPosition::z.

Referenced by UResPcp::methodCall(), and UResPcp::methodCallV().

int UPcpItem::getPointsCnt ( )
inline
SHAPE_TYPE UPcpItem::getShapeType ( )
inline

Get cloud type (either cloud, a po

References shapeType.

bool UPcpItem::hasColor ( )
inline

has this cloud color

References isXYZRGB().

Referenced by print().

bool UPcpItem::isA ( const char *  thisname)

Test name of this pcp item

Parameters
thisnameis the name to be tested against
Returns
true if name is identical - is not case sensitive

References name.

Referenced by UResPcp::getNext(), match(), UResPcp::methodCall(), UResPcp::methodCallV(), and ~UPcpItem().

bool UPcpItem::isEmpty ( )
inline

Is this cloud empty

References xyz, and xyzrgb.

Referenced by copy().

bool UPcpItem::isPolygon ( )
inline

Is the pointcloud a polygon

References polygon, and shapeType.

Referenced by print().

bool UPcpItem::isPolyline ( )
inline

Is the pointcloud a poly line

References polyline, and shapeType.

bool UPcpItem::isXYZ ( )
inline

is point cloud a xyz cloud

References xyz.

Referenced by UResPcp::add(), getNeededBufferSize(), getPoint(), getPointsCnt(), and remove().

bool UPcpItem::isXYZRGB ( )
inline

is point cloud a xyzRGB cloud

References xyzrgb.

Referenced by codeXML(), getPointsCnt(), and hasColor().

void UPcpItem::makeCloud ( POINT_CLOUD_TYPE  type)
inline
bool UPcpItem::match ( const char *  thisname)

Test name of this pcp item against a name, that may hold one final wildcard (a *) i.e. 'foo*' will match 'footprint' and 'foo', but not 'fo' and 'foo*print' will match the same as 'foo*' a '*' will match all

Parameters
thisnameis the name to be tested against (with optionally one wildcard '*')
Returns
true if name matches 'thisname' - is not case sensitive

References isA(), and name.

Referenced by UResPcp::getNext(), and ~UPcpItem().

const char * UPcpItem::print ( const char *  preStr,
char *  buff,
const int  buffCnt 
)

Print current status to this buffer string

Parameters
preStrstart by inserting this string into buffer
buffstart of buffer
bufCntlength of buffer
Returns
a pointer to the buffer

References bool2str(), getPointsCnt(), hasColor(), isPolygon(), and name.

Referenced by ~UPcpItem().

void UPcpItem::remove ( int  idx)
inline

Remove a point from point cloud

References getPointsCnt(), isXYZ(), xyz, and xyzrgb.

Referenced by UResPcp::methodCallV().

bool UPcpItem::savePCD ( const char *  filename)

Save this cloud as a PCD file (ascii),

Returns
true if saved.

References cloudType, PointXyzRgb, xyz, and xyzrgb.

Referenced by clear(), and UResPcp::savePCD().

void UPcpItem::setAsCloud ( )
inline

Set cloud as just a cloud

References cloud, copy(), and shapeType.

void UPcpItem::setAsPolygon ( )
inline

Set cloud as polygon

References polygon, and shapeType.

Referenced by UResPcp::methodCallV().

void UPcpItem::setAsPolyline ( )
inline

Set cloud as polyline

References polyline, and shapeType.

Referenced by UResPcp::add(), and UResPcp::methodCallV().

void UPcpItem::setName ( const char *  newname)

Set name of this pcp item

Parameters
newnameis the new name for the pcpgon - default is empty - max 32 characters (MNL)

References MNL, and name.

Referenced by UResPcp::add(), UResPcp::getItemXYZ(), and ~UPcpItem().

void UPcpItem::setUpdated ( )
inline

set pcpgon as updated, i.e. set the update time to now.

References UTime::now(), and updateTime.

Referenced by UResPcp::add(), and UResPcp::methodCallV().

Member Data Documentation

POINT_CLOUD_TYPE UPcpItem::cloudType

is this cloud just a 3d position, or has it color (or is empty)

Referenced by clear(), copy(), deleteCloud(), getCloudType(), UResPcp::handleNewData(), makeCloud(), savePCD(), and UPcpItem().

int UPcpItem::cooSys

coordinate system 0=odo, 1=utm, 2=map. NB! if relPoseUse is true, then the cloud is in sensor coordinates.

Referenced by codeXML(), copy(), UResPcp::handleNewData(), UResPcp::methodCallV(), UPcpItem(), UPaintPcp::update(), and UFuncKinect::updateCloud().

const int UPcpItem::MNL = 32
static

size of names

Referenced by copy(), UResPcp::handleNewData(), and setName().

char UPcpItem::name[MNL]
UPosRot UPcpItem::relPose

if relative pose, the coordinates are relative to this pose (relative to the robot)

Referenced by codeXML(), copy(), UResPcp::handleNewData(), UPcpItem(), UPaintPcp::update(), and UFuncKinect::updateCloud().

bool UPcpItem::relPoseUse

use the relative pose, that is the cloud coordinates is the local relPose coordinates, and should then be converted to robot coordinates using this relative pose relPose. If relPose is false, then the coordinates are as specified in cooSys

Referenced by codeXML(), copy(), UResPcp::handleNewData(), UPcpItem(), UPaintPcp::update(), and UFuncKinect::updateCloud().

UTime UPcpItem::sensorTime

sensor detection time - if related to a sensor

Referenced by codeXML(), copy(), UResPcp::handleNewData(), and UFuncKinect::updateCloud().

SHAPE_TYPE UPcpItem::shapeType

is this cloud a polyline, a polygon or just a cloud

Referenced by getShapeType(), isPolygon(), isPolyline(), setAsCloud(), setAsPolygon(), setAsPolyline(), UPcpItem(), and UFuncKinect::updateCloud().

UTime UPcpItem::updateTime
pcl::PointCloud<pcl::PointXYZ>* UPcpItem::xyz
pcl::PointCloud<pcl::PointXYZ>::Ptr* UPcpItem::xyzp

pointer to xyz cloud (maintained by the pool)

Referenced by deleteCloud(), makeCloud(), UPcpItem(), and UFuncKinect::updateCloud().

pcl::PointCloud<pcl::PointXYZRGB>* UPcpItem::xyzrgb
pcl::PointCloud<pcl::PointXYZRGB>::Ptr* UPcpItem::xyzrgbp

pointer to xyzcloud

Referenced by deleteCloud(), makeCloud(), UPcpItem(), and UFuncKinect::updateCloud().


The documentation for this class was generated from the following files: