FS100 robot state class. More...
#include <fs100_state.h>
Public Member Functions | |
Fs100State (const char *ip) | |
Constructor. | |
bool | getJointsUpdated (float *joints) |
Get updated joint data. | |
int | init () |
Initiator. | |
int | makeConnect () |
Creates connection. | |
void | pgmClose () |
Closes the class. | |
Private Member Functions | |
void | byteSwap (char *data, int length) |
void | deserializeJointFeedback (char *data, SimpleMsg *msg) |
void | deserializeMotionReply (char *data, SimpleMsg *msg) |
int | getLength (char *data) |
void | printJointFeedback () |
void | printMotionReply (SimpleMsg *msg) |
void | recvData () |
void | serialize (SimpleMsg *msg, char *data, int size) |
void | socketError (const char *msg) |
Static Private Member Functions | |
static void * | recvDataThread (void *This) |
Private Attributes | |
float | current_pos [6] |
int | i |
const char * | IP |
SimpleMsg | joint_data |
bool | joint_values_updated |
pthread_cond_t | mut_cond |
pthread_mutex_t | mut_lock |
int | n |
int | portno |
bool | pos_updated |
char | raw_data [148] |
pthread_t | recvthreadID |
int | run_thread |
struct sockaddr_in | serv_addr |
struct hostent * | server |
int | sockfd |
FS100 robot state class.
The FS100 robot state class handles connection with port 50241, which the FS100 uses to send robot joint position data.
Definition at line 54 of file fs100_state.h.
Fs100State::Fs100State | ( | const char * | ip | ) | [inline] |
void Fs100State::byteSwap | ( | char * | data, |
int | length | ||
) | [private] |
Definition at line 129 of file fs100_state.cpp.
void Fs100State::deserializeJointFeedback | ( | char * | data, |
SimpleMsg * | msg | ||
) | [private] |
Definition at line 148 of file fs100_state.cpp.
void Fs100State::deserializeMotionReply | ( | char * | data, |
SimpleMsg * | msg | ||
) | [private] |
Definition at line 177 of file fs100_state.cpp.
bool Fs100State::getJointsUpdated | ( | float * | joints | ) |
Get updated joint data.
A function that returns the next updated joint data. Locks on call until new data is available.
joints | is a pointer to a double[6] type. Used for returning data. |
Definition at line 247 of file fs100_state.cpp.
int Fs100State::getLength | ( | char * | data | ) | [private] |
Definition at line 241 of file fs100_state.cpp.
int Fs100State::init | ( | ) |
Initiator.
Initiates the sockect connection to the FS100 controller, and initializes internal variables.
Definition at line 34 of file fs100_state.cpp.
int Fs100State::makeConnect | ( | ) |
Creates connection.
Establishes socket connection to the FS100 controller, and starts a thread for recieving data over socket.
Definition at line 60 of file fs100_state.cpp.
void Fs100State::pgmClose | ( | ) |
Closes the class.
Closes socket connection and joins all running threads.
Definition at line 115 of file fs100_state.cpp.
void Fs100State::printJointFeedback | ( | ) | [private] |
Definition at line 221 of file fs100_state.cpp.
void Fs100State::printMotionReply | ( | SimpleMsg * | msg | ) | [private] |
Definition at line 199 of file fs100_state.cpp.
void Fs100State::recvData | ( | ) | [private] |
Definition at line 77 of file fs100_state.cpp.
void * Fs100State::recvDataThread | ( | void * | This | ) | [static, private] |
Definition at line 72 of file fs100_state.cpp.
void Fs100State::serialize | ( | SimpleMsg * | msg, |
char * | data, | ||
int | size | ||
) | [private] |
Definition at line 143 of file fs100_state.cpp.
void Fs100State::socketError | ( | const char * | msg | ) | [private] |
Definition at line 123 of file fs100_state.cpp.
float Fs100State::current_pos[6] [private] |
Current robot joint position.
Definition at line 70 of file fs100_state.h.
int Fs100State::i [private] |
Definition at line 60 of file fs100_state.h.
const char* Fs100State::IP [private] |
Variable storing ip address of target controller.
Definition at line 59 of file fs100_state.h.
SimpleMsg Fs100State::joint_data [private] |
Simple message containing joint data.
Definition at line 64 of file fs100_state.h.
bool Fs100State::joint_values_updated [private] |
Has joint data been updated?
Definition at line 65 of file fs100_state.h.
pthread_cond_t Fs100State::mut_cond [private] |
Mutex condition.
Definition at line 69 of file fs100_state.h.
pthread_mutex_t Fs100State::mut_lock [private] |
Mutex lock.
Definition at line 68 of file fs100_state.h.
int Fs100State::n [private] |
Definition at line 60 of file fs100_state.h.
int Fs100State::portno [private] |
Definition at line 60 of file fs100_state.h.
bool Fs100State::pos_updated [private] |
Is current robot joint position updated?
Definition at line 71 of file fs100_state.h.
char Fs100State::raw_data[148] [private] |
Raw buffer data.
Definition at line 66 of file fs100_state.h.
pthread_t Fs100State::recvthreadID [private] |
Thread ID for data recieving thread.
Definition at line 63 of file fs100_state.h.
int Fs100State::run_thread [private] |
Variable for sockect connection.
Definition at line 60 of file fs100_state.h.
struct sockaddr_in Fs100State::serv_addr [private] |
Struct for socket connection.
Definition at line 61 of file fs100_state.h.
struct hostent* Fs100State::server [private] |
Struct for socket connection.
Definition at line 62 of file fs100_state.h.
int Fs100State::sockfd [private] |
Definition at line 60 of file fs100_state.h.