Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
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 () VP_OVERRIDE
vpSickLDMRSoperator= (const vpSickLDMRS &sick)
bool setup (const std::string &ip, int port)
bool setup ()
bool measure (vpLaserScan laserscan[4])
void setIpAddress (std::string ip_address)
void setPort (int com_port)

Protected Attributes

int socket_fd
unsigned char * body
vpColVector vAngle
double time_offset
bool isFirstMeasure
size_t maxlen_body
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 "visp3/sensor/vpSickLDMRS.h"
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) ||
(defined(__APPLE__) && defined(__MACH__))) // 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(); vpScanPoint p;
for (unsigned int i=0; i < pointsInLayer.size(); i++) {
std::cout << pointsInLayer[i] << std::endl;
}
}
}
#endif
}
Implements a laser scan data structure that contains especially the list of scanned points that have ...
Definition vpLaserScan.h:63
std::vector< vpScanPoint > getScanPoints()
Definition vpLaserScan.h:91
std::string ip
void setIpAddress(std::string ip_address)
Class that defines a single laser scanner point.
Definition vpScanPoint.h:74
bool setup(const std::string &ip, int port)
bool measure(vpLaserScan laserscan[4])
Examples
SickLDMRS-Acq.cpp, and SickLDMRS-Process.cpp.

Definition at line 106 of file vpSickLDMRS.h.

Member Enumeration Documentation

◆ DataType

Enumerator
MeasuredData 

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

Definition at line 114 of file vpSickLDMRS.h.

◆ MagicWord

Enumerator
MagicWordC2 

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

Definition at line 109 of file vpSickLDMRS.h.

Constructor & Destructor Documentation

◆ vpSickLDMRS() [1/2]

BEGIN_VISP_NAMESPACE 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 67 of file vpSickLDMRS.cpp.

References body, vpLaserScanner::ip, isFirstMeasure, maxlen_body, vpLaserScanner::port, vpMath::rad(), socket_fd, time_offset, and vAngle.

Referenced by operator=(), and vpSickLDMRS().

◆ vpSickLDMRS() [2/2]

vpSickLDMRS::vpSickLDMRS ( const vpSickLDMRS & sick)
inline

Copy constructor.

Definition at line 122 of file vpSickLDMRS.h.

References body, isFirstMeasure, maxlen_body, socket_fd, time_offset, vAngle, vpLaserScanner::vpLaserScanner(), and vpSickLDMRS().

◆ ~vpSickLDMRS()

vpSickLDMRS::~vpSickLDMRS ( )
virtual

Destructor that deallocate the memory for the body messages.

Definition at line 84 of file vpSickLDMRS.cpp.

References body.

Member Function Documentation

◆ measure()

◆ operator=()

vpSickLDMRS & vpSickLDMRS::operator= ( const vpSickLDMRS & sick)
inline

Copy operator.

Definition at line 131 of file vpSickLDMRS.h.

References body, isFirstMeasure, maxlen_body, socket_fd, time_offset, vAngle, and vpSickLDMRS().

◆ setIpAddress()

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

Set the Ethernet address of the laser.

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

Definition at line 66 of file vpLaserScanner.h.

References ip.

Referenced by vpSickLDMRS::setup().

◆ setPort()

void vpLaserScanner::setPort ( int com_port)
inlineinherited

Set the communication port.

Definition at line 69 of file vpLaserScanner.h.

References port.

Referenced by vpSickLDMRS::setup().

◆ setup() [1/2]

bool vpSickLDMRS::setup ( )

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

Returns
true if the device was initialized, false otherwise.

Definition at line 111 of file vpSickLDMRS.cpp.

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

Referenced by setup().

◆ setup() [2/2]

bool vpSickLDMRS::setup ( const std::string & ip_address,
int com_port )

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

Parameters
ip_address: Ethernet address of the laser.
com_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 99 of file vpSickLDMRS.cpp.

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

Member Data Documentation

◆ body

unsigned char* vpSickLDMRS::body
protected

Definition at line 157 of file vpSickLDMRS.h.

Referenced by measure(), operator=(), vpSickLDMRS(), vpSickLDMRS(), and ~vpSickLDMRS().

◆ ip

std::string vpLaserScanner::ip
protectedinherited

◆ isFirstMeasure

bool vpSickLDMRS::isFirstMeasure
protected

Definition at line 160 of file vpSickLDMRS.h.

Referenced by measure(), operator=(), vpSickLDMRS(), and vpSickLDMRS().

◆ maxlen_body

size_t vpSickLDMRS::maxlen_body
protected

Definition at line 161 of file vpSickLDMRS.h.

Referenced by operator=(), vpSickLDMRS(), and vpSickLDMRS().

◆ port

int vpLaserScanner::port
protectedinherited

◆ socket_fd

int vpSickLDMRS::socket_fd
protected

Definition at line 155 of file vpSickLDMRS.h.

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

◆ time_offset

double vpSickLDMRS::time_offset
protected

Definition at line 159 of file vpSickLDMRS.h.

Referenced by measure(), operator=(), vpSickLDMRS(), and vpSickLDMRS().

◆ vAngle

vpColVector vpSickLDMRS::vAngle
protected

Definition at line 158 of file vpSickLDMRS.h.

Referenced by measure(), operator=(), vpSickLDMRS(), and vpSickLDMRS().