32 #include <sys/types.h>
34 #include <netinet/in.h>
35 #include <libplayerinterface/player.h>
43 unsigned char* string;
51 uint16_t DistanceScaling;
52 int32_t StartingAngle;
53 uint16_t AngularStepWidth;
54 uint16_t NumberMeasuredValues;
55 uint16_t ScanningFrequency;
56 uint16_t RemissionScaling;
57 uint16_t RemissionStartValue;
58 uint16_t RemissionEndValue;
66 lms400_cola (
const char* host,
int port,
int debug_mode);
73 int SetAngularResolution (
const char* password,
float ang_res,
float angle_start,
float angle_range);
74 int SetScanningFrequency (
const char* password,
float freq,
float angle_start,
float angle_range);
75 int SetResolutionAndFrequency (
float freq,
float ang_res,
float angle_start,
float angle_range);
77 int StartMeasurement (
bool intensity =
true);
78 player_laser_data ReadMeasurement ();
79 int StopMeasurement ();
81 int SetUserLevel (int8_t userlevel,
const char* password);
82 int GetMACAddress (
char** macadress);
85 int SetGateway (
char* gw);
86 int SetNetmask (
char* mask);
87 int SetPort (uint16_t port);
90 int TerminateConfiguration ();
92 int SendCommand (
const char* cmd);
97 int ReadConfirmationAndAnswer ();
99 int EnableRIS (
int onoff);
100 player_laser_config GetConfiguration ();
101 int SetMeanFilterParameters (
int num_scans);
102 int SetRangeFilterParameters (
float *ranges);
103 int EnableFilters (
int filter_mask);
106 unsigned char* ParseIP (
char* ip);
110 int assemblecommand (
unsigned char* command,
int len);
112 const char* hostname;
113 int sockfd, portno, n;
114 struct sockaddr_in serv_addr;
116 struct addrinfo *addr_ptr;
118 struct hostent *server;
124 int MeanFilterNumScans;
125 float RangeFilterTopLimit;
126 float RangeFilterBottomLimit;
128 player_laser_config Configuration;
131 unsigned char buffer[4096];
132 unsigned int bufferlength;
135 unsigned char command[BUF_SIZE];
137 std::vector<MeasurementQueueElement_t>* MeasurementQueue;
T min(T a, T b)
Return the minimum of a, b.
Definition: utility.h:91
#define PLAYER_MSG3(level, msg, a, b, c)
Definition: error.h:108
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
double ReadFloat(int section, const char *name, double value)
Read a floating point (double) value.
int AddInterface(player_devaddr_t addr)
Add an interface.
Generic message header.
Definition: player.h:162
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:75
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
double ReadTupleFloat(int section, const char *name, int index, double value)
Read a float (double) from a tuple field.
virtual void Main(void)=0
Main method for driver thread.
Definition: lms400_cola.h:64
int ReadInt(int section, const char *name, int value)
Read an integer value.
double ReadLength(int section, const char *name, double value)
Read a length (includes unit conversion, if any).
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
#define PLAYER_ERROR2(msg, a, b)
Definition: error.h:83
virtual void Update()
Update non-threaded drivers.
Definition: driver.h:423
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:112
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:106
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
int GetTupleCount(int section, const char *name)
Get the number of values in a tuple.
Class for loading configuration file information.
Definition: configfile.h:197
int ReadTupleInt(int section, const char *name, int index, int value)
Read an integer from a tuple field.
virtual int Setup()
Initialize the driver.
Definition: driver.h:386
#define PLAYER_CAPABILITIES_REQ
Capability request message type.
Definition: player.h:397
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
Definition: lms400_cola.h:42
void SetError(int code)
Set/reset error code.
Definition: driver.h:145
#define PLAYER_ERROR1(msg, a)
Definition: error.h:82
#define PLAYER_ERROR(msg)
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:553
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:170
Reference-counted message objects.
Definition: message.h:133
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
virtual int Shutdown()
Finalize the driver.
Definition: driver.h:393
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76
T max(T a, T b)
Return the maximum of a, b.
Definition: utility.h:104