6 changed files with 563 additions and 36 deletions
-
85lwrserv/include/BangBangTrajectory.h
-
13lwrserv/include/commands.h
-
45lwrserv/include/commandsHelp.h
-
1lwrserv/include/lwr4.h
-
103lwrserv/src/commands.cpp
-
336lwrserv/src/commandsHelp.cpp
@ -0,0 +1,45 @@ |
|||||
|
#ifndef _COMMANDSHELP_H_ |
||||
|
#define _COMMANDSHELP_H_ |
||||
|
|
||||
|
#include "SocketObject.h" |
||||
|
#include <stdlib.h> |
||||
|
/** |
||||
|
* @addtogroup commands |
||||
|
* Additional functions for the client commands to print help and usage of them |
||||
|
* @{ |
||||
|
* @addtogroup help |
||||
|
* @{ |
||||
|
*/ |
||||
|
|
||||
|
//Handling request for current Joint Values |
||||
|
void getPositionJointsHelp (SocketObject& client, std::string& arg); |
||||
|
//Get Position as POSE Matrix |
||||
|
void getPositionHomRowWiseHelp (SocketObject& client, std::string& arg); |
||||
|
//Get Force/torque values from TCP |
||||
|
void getForceTorqueTcpHelp (SocketObject& client, std::string& arg); |
||||
|
//Move to given Joint combination |
||||
|
void movePTPJointsHelp (SocketObject& client, std::string& arg); |
||||
|
//Move to given POSE position |
||||
|
void moveHomRowWiseStatusHelp (SocketObject& client, std::string& arg); |
||||
|
//Set Velocity |
||||
|
void setSpeedHelp (SocketObject& client, std::string& arg); |
||||
|
//Set Acceleration |
||||
|
void setAccelHelp (SocketObject& client, std::string& arg); |
||||
|
//Starting Potential Field Movement Mode |
||||
|
void startPotFieldModeHelp (SocketObject& client, std::string& arg); |
||||
|
//Stopping Potential Field Movement Mode |
||||
|
void stopPotFieldModeHelp (SocketObject& client, std::string& arg); |
||||
|
// set the current trajectory type |
||||
|
void setTrajectoryTypeHelp (SocketObject& client, std::string& arg); |
||||
|
// get the current trajectory type |
||||
|
void getTrajectoryTypeHelp (SocketObject& client, std::string& arg); |
||||
|
//Quit |
||||
|
void quitHelp (SocketObject& client, std::string& arg); |
||||
|
// check if we use a kuka |
||||
|
void isKukaLwrHelp (SocketObject& client, std::string& arg); |
||||
|
|
||||
|
/** |
||||
|
* @} |
||||
|
* @} |
||||
|
*/ |
||||
|
#endif |
@ -0,0 +1,336 @@ |
|||||
|
/**
|
||||
|
* @file |
||||
|
* @author Philipp Schoenberger <ph.schoenberger@googlemail.com> |
||||
|
* @version 1.0 |
||||
|
* |
||||
|
* @section LICENSE |
||||
|
* |
||||
|
* This program is free software; you can redistribute it and/or |
||||
|
* modify it under the terms of the GNU General Public License as |
||||
|
* published by the Free Software Foundation; either version 2 of |
||||
|
* the License, or (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, but |
||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
|
* General Public License for more details at |
||||
|
* https://www.gnu.org/copyleft/gpl.html
|
||||
|
* |
||||
|
* @section DESCRIPTION |
||||
|
* |
||||
|
* This file contains functions to process the commands |
||||
|
* coming from the client interface |
||||
|
*/ |
||||
|
#include <stdlib.h>
|
||||
|
#include <string>
|
||||
|
#include <iostream>
|
||||
|
#include "SocketObject.h"
|
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the getPositionJoints function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see getPositionJoints |
||||
|
*/ |
||||
|
void getPositionJointsHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// add the help text to the buffer
|
||||
|
out += "Request for the current joint angles from database.\n"; |
||||
|
out += "Return string is formated like: \n \t 1.0 2.0 ... 4.0 \n "; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the getPositionHomRowWise function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see getPositionHomRowWise |
||||
|
*/ |
||||
|
void getPositionHomRowWiseHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// add the help text to the buffer
|
||||
|
out += "Request for the current positions in form of a homogeneous cartesian matrix.\n"; |
||||
|
out += "The return string is formated row wise with leaving out the last line.\n"; |
||||
|
out += "\n"; |
||||
|
out += "R11 R12 R13 Tx \n"; |
||||
|
out += "R21 R22 R23 Ty \n"; |
||||
|
out += "R31 R32 R33 Tz \n"; |
||||
|
out += "0 0 0 1 \n"; |
||||
|
out += "\n"; |
||||
|
out += "Example Matrix above will be assembled to a line like the following one\n"; |
||||
|
out += "\n"; |
||||
|
out += "R11 R12 R13 Tx R21 R22 R23 Ty R31 R32 R33 Tz\n"; |
||||
|
out += "\n"; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the getForceTorqueTcp function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see getForceTorqueTcp |
||||
|
*/ |
||||
|
void getForceTorqueTcpHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// add the help text to the buffer
|
||||
|
out += "Request for the current force and torque of the Robot\n"; |
||||
|
out += "The first 3 Values are the x,y,z forces of the robot endefektor\n"; |
||||
|
out += "The second 3 values are the x,y,z rotational torques on the endefektor\n"; |
||||
|
out += "The returned string will be formated like this: \n"; |
||||
|
out += "\t Fx Fy Fz Tx Ty Tz\n"; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the movePTPJoints function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see movePTPJoints |
||||
|
*/ |
||||
|
void movePTPJointsHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// add the help text to the buffer
|
||||
|
out += "Request the server to move the robot from the current measured Position\n"; |
||||
|
out += "to the new position defined by the given parameters.\n"; |
||||
|
out += "The amount of parameters have to match exactly the number of joints of the\n"; |
||||
|
out += "Robot. Otherwise the command will return \"false\".\n"; |
||||
|
out += "Command interface is blocked after sending the command and will be up\n"; |
||||
|
out += "when the robot reached the commanded destination.\n"; |
||||
|
out += "When the movement was successfully finished the return value will be \"true\"\n"; |
||||
|
out += "The entered command should be formated like this: \n"; |
||||
|
out += "MPTP J1 J2 J3 J4 J5 J6 J7 ... \n"; |
||||
|
|
||||
|
// send msg to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the moveHomRowWiseStatus function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see moveHomRowWiseStatus |
||||
|
*/ |
||||
|
void moveHomRowWiseStatusHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the setSpeed function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see setSpeed |
||||
|
*/ |
||||
|
void setSpeedHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the setAccel function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see setAccel |
||||
|
*/ |
||||
|
void setAccelHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the startPotFieldMode function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see startPotFieldMode |
||||
|
*/ |
||||
|
void startPotFieldModeHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the stopPotFieldMode function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see stopPotFieldMode |
||||
|
*/ |
||||
|
void stopPotFieldModeHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the quit function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see quit |
||||
|
*/ |
||||
|
void quitHelp(SocketObject& client , std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the quit function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see quit |
||||
|
*/ |
||||
|
void setTrajectoryTypeHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the getTrajectoryType function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see getTrajectoryType |
||||
|
*/ |
||||
|
void getTrajectoryTypeHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
||||
|
|
||||
|
/**
|
||||
|
* This function returns the help information text to the client |
||||
|
* for the isKukaLwr function. |
||||
|
* |
||||
|
* @param client connection to client which will receive the response |
||||
|
* @param arg unused but has to be there for matching the signature |
||||
|
* |
||||
|
* @see isKukaLwr |
||||
|
*/ |
||||
|
void isKukaLwrHelp(SocketObject& client, std::string& arg) |
||||
|
{ |
||||
|
// unused
|
||||
|
(void) arg; |
||||
|
|
||||
|
// set up the string buffers
|
||||
|
std::string out = ""; |
||||
|
|
||||
|
// send message to client
|
||||
|
client.Send(out); |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue