Interfaces

From jderobot
Jump to: navigation, search

ArDrone Extra[edit]

Allows you to send orders to drones.

Slice definition

ArDroneExtra Interface[edit]

  • void land() - land drone.
  • void takeoff() - takeoff drone.
  • void reset()
  • void recordOnUsb(bool record)
  • void ledAnimation(int type,float duration, float req)
  • void flightAnimation(int type, float duration)
  • void flatTrim()
  • void toggleCam() - switch camera.


Camera[edit]

Slice definition

CameraDescription Class[edit]

Represents intrinsic parametres of pinhole camera model

  class CameraDescription
  {
    string name;
    string shortDescription;
    string streamingUri;
    float fdistx;
    float fdisty;
    float u0;
    float v0;
    float skew;
    float posx;
    float posy;
    float posz;
    float foax;
    float foay;
    float foaz;
    float roll;
  };

Camera Interface[edit]

Extends ImageProvider and it allows us to obtain streaming in addition to images.

  • CameraDescription getCameraDescription() - gets cameraDescription
  • int setCameraDescription(CameraDescription description) - sets CameraDescription
  • string startCameraStreaming() - starts the streaming
  • void stopCameraStreaming() - stops streaming
  • void reset() -
  • ImageProvider methods


CMDVel[edit]

It allows us to send the information of the speeds to the drones.

Slice definition

CMDVelData class[edit]

It is the container for all speeds to send.

class CMDVelData
{
	float linearX;
	float linearY;
	float linearZ;
	float angularX;
	float angularY;
	float angularZ;										
};

In the next image we see necessary velocities to teleoperate the Ardrones:

CMDVel Interface[edit]

  • int setCMDVelData(CMDVelData data) - sends speeds to server


Image[edit]

Slice definition

ImageDescription class[edit]

It represents the basic information of the image.

class ImageDescription 
  {
    int width; 		/**< %Image width [pixels] */
    int height;		/**< %Image height [pixels] */
    int size;		/**< %Image size [bytes] */
    string format; 	/**< %Image format string */
    string md5sum;
  };

ImageData class[edit]

A single image served as a sequence of bytes.

class ImageData
  { 
    Time timeStamp; 				/**< TimeStamp of Data */
    ImageDescription description; 	/**< ImageDescription of Data, for convienence purposes */
    ByteSeq pixelData; 				/**< The image data itself. The structure of this byte sequence depends on the image format and compression. */
  };

RGB Cameras (RGB8 format)

In RGB cameras, each pixel is represented by 3 integers of pixelData

 pixels[0].r = pixelData[0];
 pixels[0].g = pixelData[1];
 pixels[0].b = pixelData[2];

 pixels[1].r = pixelData[3];
 pixels[1].g = pixelData[4];
 pixels[1].b = pixelData[5];

Depth Image in RGBD sensors (DEPTH8_16 format)

All JdeRobot components that provides depth images uses the next format, assuming that we have the distance between each

pixel and the sensor in the integer "depth", and "MAX_LENGTH" is a constant that contains the maximum distance that the

sensor is able to obtain :

  • The component "R" (Red) has distance betwen each pixel and the sensor in gray scale
R=(float(depth)/(float)MAX_LENGTH)*255;
  • The component "G" (Green) contains the 8 higher value bits of distance "depth"
G=depth>>8;
  • The component "B" (Blue) contains the 8 lower value bits of distance "depth"
B=depth&0xff;

Compressed Images (DEPTH8_16_Z , RGB8_Z formats)

To compress the images, the server uses the zlib.h library. To decompress the images (Using C++), we should add this library:

#include <zlib.h> 

And with the following code, the decompressed image is stored in origin_buf:

size_t dest_len = dataPtr->description->width*dataPtr->description->height*3; 
size_t source_len = dataPtr->pixelData.size(); 
 
unsigned char* origin_buf = (uchar*) malloc(dest_len); 
 
int r = uncompress((Bytef *) origin_buf, (uLongf *) &dest_len, (const Bytef *) &(dataPtr->pixelData[0]), (uLong)source_len);

ImageProvider Interface[edit]

  • ImageData getImageData(string format) - Returns image with specified format
  • ImageDescription getImageDescription() - Returns image description
  • ImageFormat getImageFormat() - return image format (string)

ImageConsumer Interface[edit]

  • void report( ImageData obj ) - Transmits the data to the consumer



Laser[edit]

Slice definition

LaserData class[edit]

It represents all measures of lasers.

class LaserData
{
        IntSeq distanceData; /* Array of distances [mm]*/
	int numLaser;        /* Number of lasers */
};

Distances are read from numLaser lasers from right to left according to the following scheme:

Laser Interfaz[edit]

  • LaserData getLaserData() - returns lasers measures


Motors[edit]

It allows us to interact with robots motors.

  • V: forward speed (m/s)
  • W: angular speed (rad/s)
  • L: lateral speed for humaoids robots

Slice definition

Motors Interface[edit]

  • float getV() - Returns V speed
  • int setV(float v) - Sets V speed
  • float getW() - Returns W speed
  • int setW(float w) - Sets W speed
  • float getL() - Returns L speed
  • int setL(float l) - Sets L speed


Navdata[edit]

It allows us to obtain much information of drone, as a percentage of remaining battery, speed, acceleration, altitude...

Slice definition

NavdataData Class[edit]

Represents all data can be obtain.

class NavdataData 
{
 int vehicle; //0-> ArDrone1, 1-> ArDrone2
 int state; // landed, flying,...
 float batteryPercent; //The remaing charge of baterry %
		
 //Magnetometer ArDrone 2.0
 int magX;
 int magY;
 int magZ;
		
 int pressure; //Barometer ArDrone 2.0
 int temp;     //Temperature sensor ArDrone 2.0
 float windSpeed; //Estimated wind speed ArDrone 2.0		
		
 float windAngle;
 float windCompAngle;
 
 float rotX; //rotation about the X axis
 float rotY; //rotation about the Y axis		
 float rotZ; //rotation about the Z axis
 
 int altd; //Estimated altitude (mm) 

 //linear velocities (mm/sec)
 float vx;
 float vy;
 float vz;
		
 //linear accelerations (unit: g) ¿ArDrone 2.0?
 float ax;
 float ay;
 float az;

 //Tags in Vision Detectoion
 //Should be unsigned
 int tagsCount;
 arrayInt tagsType;
 arrayInt tagsXc;
 arrayInt tagsYc;
 arrayInt tagsWidth;
 arrayInt tagsHeight;
 arrayFloat tagsOrientation;
 arrayFloat tagsDistance;

 float tm; //time stamp
};

Navdata Interface[edit]

  • NavdataData getNavdata() - returns NavdataData

Pose3D[edit]

Slice definition

Pose3DData class[edit]

Represents position and orientation.

Pose3DData
  {
	float x;  /* x coord */
	float y;  /* y coord */
	float z;  /* z coord */
  	float h;  /* */
	float q0; /* qw */
	float q1; /* qx */
	float q2; /* qy */
	float q3; /* qz */
  };
  • x,y,z - position

  • q0,q1,q2,q3 - quaternion for orientation. To convert quaternion to yaw, pitch and roll use the folowing equation (more info in this link):

Pose3D Interface[edit]

  • Pose3DData getPose3DData() - Returns Pose3D data
  • int setPose3DData(Pose3DData data) - Sets Pose3D data