humotion / examples / meka / src / main.cpp @ 1c758459
History | View | Annotate | Download (1.405 KB)
| 1 |
#include <stdio.h> |
|---|---|
| 2 |
#include <humotion/server/server.h> |
| 3 |
#include <string> |
| 4 |
#include <iostream> |
| 5 |
//#include "meka_data_receiver.h"
|
| 6 |
#include "mekajointinterface.h" |
| 7 |
|
| 8 |
using namespace std; |
| 9 |
|
| 10 |
int main(int argc, char *argv[]){ |
| 11 |
/*Property params;
|
| 12 |
params.fromCommand(argc, argv);
|
| 13 |
|
| 14 |
if (!params.check("robot")){
|
| 15 |
fprintf(stderr, "Please specify the name of the robot\n");
|
| 16 |
fprintf(stderr, "--robot name (e.g. icub or icubSim)\n");
|
| 17 |
return -1;
|
| 18 |
}
|
| 19 |
|
| 20 |
string robotName=params.find("robot").asString().c_str();
|
| 21 |
string scope="/"+robotName;
|
| 22 |
|
| 23 |
*/
|
| 24 |
|
| 25 |
if (argc != 4){ |
| 26 |
printf("> ERROR: invalid number of parameters passed to server!\n\nusage: %s <humotion base topic> <jointstates topic> <control topic> (example: %s /meka /joint_states /meka_roscontrol/head_position_trajectory_controller/command)\n\n",argv[0],argv[0]); |
| 27 |
exit(EXIT_FAILURE); |
| 28 |
} |
| 29 |
|
| 30 |
//create humotion interface
|
| 31 |
string humotion_scope = argv[1]; |
| 32 |
string jointstates_scope = argv[2]; |
| 33 |
string control_scope = argv[3]; |
| 34 |
|
| 35 |
|
| 36 |
MekaJointInterface *jointinterface = new MekaJointInterface(jointstates_scope, control_scope);
|
| 37 |
humotion::server::Server *humotion_server = new humotion::server::Server(humotion_scope, "ROS", jointinterface); |
| 38 |
|
| 39 |
//finally run it
|
| 40 |
jointinterface->run(); |
| 41 |
|
| 42 |
while(humotion_server->ok()){
|
| 43 |
usleep(100000);
|
| 44 |
} |
| 45 |
|
| 46 |
printf("> ros connection died, will exit now\n");
|
| 47 |
|
| 48 |
return 0; |
| 49 |
} |