ViSP  2.6.2
vpSickLDMRS Class Reference

#include <vpSickLDMRS.h>

+ Inheritance diagram for vpSickLDMRS:

Public Types

enum  MagicWord { MagicWordC2 = 0xAFFEC0C2 }
 
enum  DataType { MeasuredData = 0x2202 }
 

Public Member Functions

 vpSickLDMRS ()
 
 vpSickLDMRS (const vpSickLDMRS &sick)
 
virtual ~vpSickLDMRS ()
 
bool setup (std::string ip, int port)
 
bool setup ()
 
bool measure (vpLaserScan laserscan[4])
 
void setIpAddress (std::string ip)
 
void setPort (int port)
 

Protected Attributes

SOCKET socket_fd
 
std::string ip
 
int port
 

Detailed Description

Driver for the Sick LD-MRS laser scanner.

Warning
For the moment, this driver works only on UNIX platform.

The code below shows how the four laser scan provided by the Sick LD-MRS could be acquired.

#include "visp/vpSickLDMRS.h"
int main()
{
#ifdef UNIX
std::string ip = "131.254.12.119";
vpSickLDMRS laser;
laser.setIpAddress(ip);
laser.setup();
vpLaserScan laserscan[4];
for ( ; ; ) {
// Get the measured points in the four layers
laser.measure(laserscan);
// Prints all the measured points
for (int layer=0; layer<4; layer++) {
std::vector<vpScanPoint> pointsInLayer = laserscan[layer].getScanPoints();
for (unsigned int i=0; i < pointsInLayer.size(); i++) {
std::cout << pointsInLayer[i] << std::endl;
}
}
}
#endif
}
Examples:
SickLDMRS-Acq.cpp, and SickLDMRS-Process.cpp.

Definition at line 109 of file vpSickLDMRS.h.

Member Enumeration Documentation

Enumerator
MeasuredData 

Flag to indicate that the body of a message contains measured data.

Definition at line 115 of file vpSickLDMRS.h.

Enumerator
MagicWordC2 

The magic word that allows to identify the messages that are sent by the Sick LD-MRS.

Definition at line 112 of file vpSickLDMRS.h.

Constructor & Destructor Documentation

vpSickLDMRS::vpSickLDMRS ( )

Default constructor that initialize the Ethernet address to "131.254.12.119", set the port to 12002 and allocates memory for the body messages.

Definition at line 73 of file vpSickLDMRS.cpp.

References vpLaserScanner::ip, vpLaserScanner::port, vpMath::rad(), and vpColVector::resize().

vpSickLDMRS::vpSickLDMRS ( const vpSickLDMRS sick)
inline

Copy constructor.

Definition at line 120 of file vpSickLDMRS.h.

References socket_fd.

vpSickLDMRS::~vpSickLDMRS ( )
virtual

Destructor that deallocate the memory for the body messages.

Definition at line 92 of file vpSickLDMRS.cpp.

Member Function Documentation

void vpLaserScanner::setIpAddress ( std::string  ip)
inlineinherited

Set the Ethernet address of the laser.

Examples:
SickLDMRS-Acq.cpp, and SickLDMRS-Process.cpp.

Definition at line 77 of file vpLaserScanner.h.

Referenced by setup().

void vpLaserScanner::setPort ( int  port)
inlineinherited

Set the communication port.

Definition at line 82 of file vpLaserScanner.h.

Referenced by setup().

bool vpSickLDMRS::setup ( std::string  ip,
int  port 
)

Initialize the connexion with the Sick LD-MRS laser scanner.

Parameters
ip: Ethernet address of the laser.
port: Ethernet port of the laser.
Returns
true if the device was initialized, false otherwise.
Examples:
SickLDMRS-Acq.cpp, and SickLDMRS-Process.cpp.

Definition at line 107 of file vpSickLDMRS.cpp.

References vpLaserScanner::setIpAddress(), vpLaserScanner::setPort(), and setup().

bool vpSickLDMRS::setup ( )

Initialize the connexion with the Sick LD-MRS laser scanner.

Returns
true if the device was initialized, false otherwise.

Definition at line 119 of file vpSickLDMRS.cpp.

References vpLaserScanner::ip, vpLaserScanner::port, and socket_fd.

Referenced by setup().

Member Data Documentation

std::string vpLaserScanner::ip
protectedinherited

Definition at line 84 of file vpLaserScanner.h.

Referenced by setup(), vpLaserScanner::vpLaserScanner(), and vpSickLDMRS().

int vpLaserScanner::port
protectedinherited

Definition at line 88 of file vpLaserScanner.h.

Referenced by setup(), vpLaserScanner::vpLaserScanner(), and vpSickLDMRS().

SOCKET vpSickLDMRS::socket_fd
protected

Definition at line 131 of file vpSickLDMRS.h.

Referenced by measure(), setup(), and vpSickLDMRS().