Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
cyberglove::CybergloveSerial Class Reference

#include <serial_glove.hpp>

List of all members.

Public Member Functions

 CybergloveSerial (std::string serial_port, boost::function< void(std::vector< float >, bool)> callback)
int get_nb_msgs_received ()
int set_filtering (bool value)
int set_frequency (std::string frequency)
int set_transmit_info (bool value)
int start_stream ()
 ~CybergloveSerial ()

Static Public Attributes

static const unsigned short glove_size = 22

Private Member Functions

void stream_callback (char *world, int length)

Private Attributes

bool button_on
boost::function< void(std::vector
< float >, bool)> 
callback_function
boost::shared_ptr
< cereal::CerealPort
cereal_port
int current_value
int glove_pos_index
std::vector< float > glove_positions
 A vector containing the current joints positions.
bool light_on
int nb_msgs_received
bool no_errors
 Did we get any garbage in the received message?

Detailed Description

This class uses the Cereal Port ROS package to connect to and interact with the Cyberglove.

Definition at line 99 of file serial_glove.hpp.


Constructor & Destructor Documentation

cyberglove::CybergloveSerial::CybergloveSerial ( std::string  serial_port,
boost::function< void(std::vector< float >, bool)>  callback 
)

Initializes the connection with the cyberglove through the given serial port.

Parameters:
serial_portthe path to the serial port, /dev/ttyS0 by default
callbacka pointer to a callback function, which will be called each time a complete joint message is received.

Definition at line 42 of file serial_glove.cpp.

Definition at line 59 of file serial_glove.cpp.


Member Function Documentation

We keep the count of all the messages received for the glove.

Returns:
the number of received messages.

Definition at line 191 of file serial_glove.cpp.

Turns on or off the filtering (done directly in the cyberglove). By default the filtering is activated. We recommend turning it off if you want to do oversampling, to get the fastest rate (the rate is divided by 2-3 if the filtering is on)

Parameters:
valuetrue if you want to turn it on.
Returns:
0 if success

Definition at line 66 of file serial_glove.cpp.

int cyberglove::CybergloveSerial::set_frequency ( std::string  frequency)

Set the transmit frequency for the cyberglove.

Parameters:
frequencyuse the elements of the struct cyberglove_freq::CybergloveFreq
Returns:
0 if success

Definition at line 106 of file serial_glove.cpp.

Turns on or off the status transmission: if it's on, then a char is added to the message to describe the current status of the glove. For this status byte, the bit 1 corresponds to the button status, and the bit 2 corresponds to the light status.

Parameters:
valuetrue if you want to turn it on.
Returns:
0 if success

Definition at line 86 of file serial_glove.cpp.

Start streaming the data from the cyberglove, calling the callback function each time the full message is received.

Returns:
0 if success

Definition at line 116 of file serial_glove.cpp.

void cyberglove::CybergloveSerial::stream_callback ( char *  world,
int  length 
) [private]

The callback function for the raw data coming from the serial port, bound to the cereal_port callback. The data received here is not received message by messages: it's a stream of data, coming at different intervals (the whole messages are received at a given frequency though)

Parameters:
worlda table of char containing the binary values from the serial port
lengththe length of the received message.

Definition at line 129 of file serial_glove.cpp.


Member Data Documentation

Definition at line 194 of file serial_glove.hpp.

boost::function<void(std::vector<float>, bool)> cyberglove::CybergloveSerial::callback_function [private]

The pointer to the function called each time a full message is received. This function is linked when instantiating the class.

Definition at line 192 of file serial_glove.hpp.

CerealPort is the ROS library used to talk to the serial port.

Definition at line 168 of file serial_glove.hpp.

Definition at line 186 of file serial_glove.hpp.

Definition at line 182 of file serial_glove.hpp.

A vector containing the current joints positions.

Definition at line 184 of file serial_glove.hpp.

const unsigned short cyberglove::CybergloveSerial::glove_size = 22 [static]

The number of sensors in the glove.

Definition at line 161 of file serial_glove.hpp.

Definition at line 194 of file serial_glove.hpp.

Definition at line 182 of file serial_glove.hpp.

Did we get any garbage in the received message?

Definition at line 197 of file serial_glove.hpp.


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


cyberglove
Author(s): Ugo Cupcic
autogenerated on Fri Jan 3 2014 12:04:16