humotion / examples / meka / src / main.cpp @ 4b77b008
History | View | Annotate | Download (1.583 KB)
1 | 2be6243f | Sebastian Meyer zu Borgsen | #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 | 6168b08c | Simon Schulz | if (argc != 5){ |
26 | printf("> ERROR: invalid number of parameters passed to server!\n\n");
|
||
27 | printf("usage : %s <humotion base topic> <jointstates topic> <controlstates topic> <control output topic>\n\n",argv[0]); |
||
28 | printf("example : %s /meka /joint_states /meka_roscontrol_state_manager/state /meka_roscontrol/head_position_trajectory_controller/command)\n\n",argv[0]); |
||
29 | 89374d69 | Simon Schulz | exit(EXIT_FAILURE); |
30 | } |
||
31 | |||
32 | 2be6243f | Sebastian Meyer zu Borgsen | //create humotion interface
|
33 | 6168b08c | Simon Schulz | string humotion_scope = argv[1]; |
34 | string jointstates_scope = argv[2]; |
||
35 | string controlstates_scope = argv[3]; |
||
36 | string control_scope = argv[4]; |
||
37 | 89374d69 | Simon Schulz | |
38 | |||
39 | 6168b08c | Simon Schulz | MekaJointInterface *jointinterface = new MekaJointInterface(jointstates_scope, controlstates_scope, control_scope);
|
40 | 89374d69 | Simon Schulz | humotion::server::Server *humotion_server = new humotion::server::Server(humotion_scope, "ROS", jointinterface); |
41 | 2be6243f | Sebastian Meyer zu Borgsen | |
42 | a4795834 | Simon Schulz | //finally run it
|
43 | 2be6243f | Sebastian Meyer zu Borgsen | jointinterface->run(); |
44 | |||
45 | while(humotion_server->ok()){
|
||
46 | usleep(100000);
|
||
47 | } |
||
48 | |||
49 | dff8ce51 | Simon Schulz | printf("> ros connection died, will exit now\n");
|
50 | |||
51 | 2be6243f | Sebastian Meyer zu Borgsen | return 0; |
52 | } |