Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Fs100Cmd Class Reference

FS100 robot commander class. More...

#include <fs100_cmd.h>

List of all members.

Public Member Functions

bool addCmdToQueue (cmd cmd_point)
 Adds a command to internal queue.
bool addPointToQueue (float pos[6], float vel[6], float time)
 Adds a point to internal queue.
 Fs100Cmd (const char *ip)
 Constructor.
int init ()
 Initiator.
int makeConnect ()
 Creates connection.
void pgmClose ()
 Closes the class.
bool pushTraj (float pos[6], float vel[6], float time, int seq)
 Sends trajectory point.
bool resetTrajectory (int *retry)
 Resets trajectory.
int start (int retry)
 Starts sending thread.

Private Member Functions

int buildTrajFull (SimpleMsg *tm, float pos[6], float vel[6], float time, int seq)
int buildTrajPos (SimpleMsg *tm, float pos[6], float time, int seq)
void byteSwap (char *data, int length)
void cmdPush ()
void deserializeMotionReply (char *data, SimpleMsg *msg)
int getLength (char *data)
void motionReady (SimpleMsg *msg)
void printErrorCodeMsg (SimpleMsg *msg)
void printMotionReply (SimpleMsg *msg)
void printTrajFull (SimpleMsg *msg)
void serialize (SimpleMsg *msg, char *data, int size)
void socketError (const char *msg)
void trajectoryStart (SimpleMsg *msg)
void trajectoryStop (SimpleMsg *msg)

Static Private Member Functions

static void * cmdPushThread (void *This)

Private Attributes

float abs_time
std::queue< cmdcmdList
pthread_t cmdthreadID
int i
const char * IP
SimpleMsg joint_data
char motion_reply_buffer [76]
SimpleMsg motion_rpl
int n
int portno
char raw_data [255]
int run_thread
volatile int seq
struct sockaddr_in serv_addr
struct hostent * server
int sockfd
volatile bool stop_all
unsigned int thread_sleep
char traj_buffer [152]

Detailed Description

FS100 robot commander class.

The FS100 robot commander class handles connection with port 50240, which the FS100 uses to recieve robot commands.

Definition at line 62 of file fs100_cmd.h.


Constructor & Destructor Documentation

Fs100Cmd::Fs100Cmd ( const char *  ip) [inline]

Constructor.

Constructor for FS100 commander class.

Definition at line 108 of file fs100_cmd.h.


Member Function Documentation

bool Fs100Cmd::addCmdToQueue ( cmd  cmd_point)

Adds a command to internal queue.

Adds a command struct to internal queue, which will be sent to controller as fast as possible.

See also:
cmd
Parameters:
cmd_pointthe command struct containing trajectory data.

Definition at line 232 of file fs100_cmd.cpp.

bool Fs100Cmd::addPointToQueue ( float  pos[6],
float  vel[6],
float  time 
)

Adds a point to internal queue.

Adds a trajectory point to internal queue, which will be sent to controller as fast as possible. The data provided is converted to a cmd struct and put into internal queue.

Parameters:
posspecifies trajectory point position.
velspecifies trajectory point velocity.
timespecifies trajectory point time from last point.

Definition at line 240 of file fs100_cmd.cpp.

int Fs100Cmd::buildTrajFull ( SimpleMsg tm,
float  pos[6],
float  vel[6],
float  time,
int  seq 
) [private]

Definition at line 524 of file fs100_cmd.cpp.

int Fs100Cmd::buildTrajPos ( SimpleMsg tm,
float  pos[6],
float  time,
int  seq 
) [private]

Definition at line 491 of file fs100_cmd.cpp.

void Fs100Cmd::byteSwap ( char *  data,
int  length 
) [private]

Definition at line 332 of file fs100_cmd.cpp.

void Fs100Cmd::cmdPush ( ) [private]

Definition at line 88 of file fs100_cmd.cpp.

void * Fs100Cmd::cmdPushThread ( void *  This) [static, private]

Definition at line 80 of file fs100_cmd.cpp.

void Fs100Cmd::deserializeMotionReply ( char *  data,
SimpleMsg msg 
) [private]

Definition at line 356 of file fs100_cmd.cpp.

int Fs100Cmd::getLength ( char *  data) [private]

Definition at line 557 of file fs100_cmd.cpp.

int Fs100Cmd::init ( )

Initiator.

Initiates the sockect connection to the FS100 controller, and initializes internal variables.

Definition at line 32 of file fs100_cmd.cpp.

Creates connection.

Establishes socket connection to the FS100 controller.

Definition at line 67 of file fs100_cmd.cpp.

void Fs100Cmd::motionReady ( SimpleMsg msg) [private]

Definition at line 566 of file fs100_cmd.cpp.

Closes the class.

Closes socket connection and joins all running threads.

Definition at line 629 of file fs100_cmd.cpp.

void Fs100Cmd::printErrorCodeMsg ( SimpleMsg msg) [private]

Definition at line 437 of file fs100_cmd.cpp.

void Fs100Cmd::printMotionReply ( SimpleMsg msg) [private]

Definition at line 379 of file fs100_cmd.cpp.

void Fs100Cmd::printTrajFull ( SimpleMsg msg) [private]

Definition at line 403 of file fs100_cmd.cpp.

bool Fs100Cmd::pushTraj ( float  pos[6],
float  vel[6],
float  time,
int  seq 
)

Sends trajectory point.

Tries to send trajectory point to FS100 controller. Will try until success is reported by FS100 controller.

Parameters:
posspecifies trajectory point position.
velspecifies trajectory point velocity.
timespecifies trajectory point time from last point.
seqspeciefies trajectory point sequence number.

Definition at line 197 of file fs100_cmd.cpp.

bool Fs100Cmd::resetTrajectory ( int *  retry)

Resets trajectory.

Resets current trajectory. Empties internal queue, and send trajectory stop followed by trajectory start.

Parameters:
retryspecifies if the function should retry until FS100 reports success (retry = 1) or just send one message (retry = 0).

Definition at line 255 of file fs100_cmd.cpp.

void Fs100Cmd::serialize ( SimpleMsg msg,
char *  data,
int  size 
) [private]

Definition at line 349 of file fs100_cmd.cpp.

void Fs100Cmd::socketError ( const char *  msg) [private]

Definition at line 323 of file fs100_cmd.cpp.

int Fs100Cmd::start ( int  retry)

Starts sending thread.

Starts thread that handles internal command queue and sends commands to FS100 controller. Also sends the first trajectory start message, powering on robot servos and making it ready for further commands.

Parameters:
retryspecifies if the function should retry until FS100 reports success (retry = 1) or just send one message (retry = 0).

Definition at line 119 of file fs100_cmd.cpp.

void Fs100Cmd::trajectoryStart ( SimpleMsg msg) [private]

Definition at line 587 of file fs100_cmd.cpp.

void Fs100Cmd::trajectoryStop ( SimpleMsg msg) [private]

Definition at line 608 of file fs100_cmd.cpp.


Member Data Documentation

float Fs100Cmd::abs_time [private]

Definition at line 69 of file fs100_cmd.h.

std::queue<cmd> Fs100Cmd::cmdList [private]

Definition at line 82 of file fs100_cmd.h.

pthread_t Fs100Cmd::cmdthreadID [private]

Definition at line 76 of file fs100_cmd.h.

int Fs100Cmd::i [private]

Definition at line 66 of file fs100_cmd.h.

const char* Fs100Cmd::IP [private]

Definition at line 65 of file fs100_cmd.h.

Definition at line 77 of file fs100_cmd.h.

char Fs100Cmd::motion_reply_buffer[76] [private]

Definition at line 80 of file fs100_cmd.h.

Definition at line 77 of file fs100_cmd.h.

int Fs100Cmd::n [private]

Definition at line 66 of file fs100_cmd.h.

int Fs100Cmd::portno [private]

Definition at line 66 of file fs100_cmd.h.

char Fs100Cmd::raw_data[255] [private]

Definition at line 78 of file fs100_cmd.h.

int Fs100Cmd::run_thread [private]

Definition at line 66 of file fs100_cmd.h.

volatile int Fs100Cmd::seq [private]

Definition at line 67 of file fs100_cmd.h.

struct sockaddr_in Fs100Cmd::serv_addr [private]

Definition at line 74 of file fs100_cmd.h.

struct hostent* Fs100Cmd::server [private]

Definition at line 75 of file fs100_cmd.h.

int Fs100Cmd::sockfd [private]

Definition at line 66 of file fs100_cmd.h.

volatile bool Fs100Cmd::stop_all [private]

Definition at line 70 of file fs100_cmd.h.

unsigned int Fs100Cmd::thread_sleep [private]

Definition at line 68 of file fs100_cmd.h.

char Fs100Cmd::traj_buffer[152] [private]

Definition at line 79 of file fs100_cmd.h.


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


fs100_motoman
Author(s): Asger Winther-Jørgensen (Technical Univeristy of Denmark)
autogenerated on Fri Aug 28 2015 10:42:16