33 # include "keyboard.h" 47 int main(
int argc,
char *argv[]) {
49 std::cout <<
"usage: kni_wrapper CONFIGFILE IP_ADDR CYCLES" << std::endl;
52 int numberOfCycles = atoi(argv[3]);
58 std::cout <<
"ERROR: " << e.
message() << std::endl;
61 std::cout <<
"-------------------------------------------" << std::endl;
62 std::cout <<
"success: katana initiated" << std::endl;
63 std::cout <<
"starting to call KNI interfaces" << std::endl;
64 std::cout <<
"interfaces in brackets[] are only being called implicitly" << std::endl;
65 std::cout <<
"-------------------------------------------" << std::endl;
69 for(
int loops = 0; loops < numberOfCycles; loops++){
72 std::cout <<
"Read Input 1. Value: " << value << std::endl;
74 printInterface(
"[moveMot(int axis, int enc, int speed, int accel)],\n \ 75 getEncoder(int axis),\n \ 76 [waitForMot(int axis, int targetpos=0, int tolerance=0)]\n \ 77 moveMotAndWait(int axis, int targetpos, int tolerance=0)\n");
92 [motorOn(int axis)],\n \ 103 printInterface(
"moveToPosEnc(int enc1, int enc2, int enc3, int enc4, int enc5, int enc6, int velocity, int acceleration, int tolerance)\n");
105 std::cout <<
"startencoder: "<<
enc[i]<<
",\ttargetenc: "<<
targetenc[i]<< std::endl;
110 printInterface(
"getPosition(struct TPos &pos), moveToPos(struct TPos pos)\n");
112 current_position = (
struct TPos*)malloc(
sizeof(
TPos));
113 target_position = (
struct TPos*)malloc(
sizeof(
TPos));
122 printInterface(
"moveToPosLin(struct TPos startPos, struct TPos targetPos)\n");
126 tmpPos = (
struct TPos*)malloc(
sizeof(
TPos));
128 tmpPos->
Y = tmpPos->
Y - 160.0;
130 tmpPos->
X = tmpPos->
X - 300.0;
132 tmpPos->
Z = tmpPos->
Z + 150;
141 std::cout <<
"Read Input 1. Value: " << value << std::endl;
146 std::cout <<
"ERROR: " << e.
message() << std::endl;
153 std::cout <<
"Calling interface: "<< _interface << std::endl;
std::string message() const
const int POSITIONAL_OFFSET
extern C because we want to access these interfaces from anywhere:
const int DEFAULT_ACCELERATION
double X
The position in cartesian space.
void printInterface(std::string _interface)
int main(int argc, char *argv[])