Revision dff8ce51
| examples/meka/src/main.cpp | ||
|---|---|---|
| 43 | 43 |
usleep(100000); |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
printf("> ros connection died, will exit now\n");
|
|
| 47 |
|
|
| 46 | 48 |
return 0; |
| 47 | 49 |
} |
| examples/meka/src/mekajointinterface.cpp | ||
|---|---|---|
| 64 | 64 |
ros::init(argc, (char**)NULL, "meka_humotion"); |
| 65 | 65 |
ros::NodeHandle n; |
| 66 | 66 |
|
| 67 |
|
|
| 68 | 67 |
printf("> listening on jointstates on '%s'\n",input_scope.c_str());
|
| 69 | 68 |
joint_state_subscriber = n.subscribe(input_scope, 150, &MekaJointInterface::incoming_jointstates , this); |
| 70 | 69 |
|
| 71 | 70 |
printf("> sending targets on '%s'\n", output_scope.c_str());
|
| 72 | 71 |
target_publisher = n.advertise<trajectory_msgs::JointTrajectory>(output_scope, 100); |
| 73 | 72 |
|
| 74 |
|
|
| 75 | 73 |
//tell humotion about min/max joint values: |
| 76 | 74 |
init_joints(); |
| 77 | 75 |
} |
| src/server/middleware_ros.cpp | ||
|---|---|---|
| 38 | 38 |
|
| 39 | 39 |
//! constructor |
| 40 | 40 |
MiddlewareROS::MiddlewareROS(string scope, Controller *c) : Middleware(scope, c){
|
| 41 |
|
|
| 41 |
printf("> using ROS middleware\n");
|
|
| 42 | 42 |
|
| 43 | 43 |
//start ros core? |
| 44 | 44 |
if (ros::isInitialized()){
|
| 45 |
//oh another process is doing ros comm, fine, we do not need to call it |
|
| 45 |
//oh another process is doing ros comm, fine, we do not need to call it
|
|
| 46 | 46 |
tick_necessary = false; |
| 47 | 47 |
}else{
|
| 48 | 48 |
//we have to take care of ros |
| src/server/middleware_rsb.cpp | ||
|---|---|---|
| 48 | 48 |
|
| 49 | 49 |
//! constructor |
| 50 | 50 |
MiddlewareRSB::MiddlewareRSB(string scope, Controller *c) : Middleware(scope, c){
|
| 51 |
printf("> using RSB middleware\n");
|
|
| 51 | 52 |
printf("> registering converters\n");
|
| 52 | 53 |
|
| 53 | 54 |
//converter for GazeTarget |
| src/server/server.cpp | ||
|---|---|---|
| 97 | 97 |
//calculate loop delay: |
| 98 | 98 |
float loop_delay = 1000.0 / MOTION_UPDATERATE; |
| 99 | 99 |
boost::system_time timeout = get_system_time() + posix_time::milliseconds(loop_delay); |
| 100 |
|
|
| 100 |
/* |
|
| 101 | 101 |
//wait for incoming joint data: |
| 102 | 102 |
while (middleware->ok()){
|
| 103 | 103 |
//mw tick |
| ... | ... | |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
printf("> joint data arrived, will activate control loop now.\n");
|
| 123 |
|
|
| 123 |
*/ |
|
| 124 | 124 |
//fine, data is arriving, activate and run control loop: |
| 125 | 125 |
while (middleware->ok()){
|
| 126 | 126 |
//mw tick |
Also available in: Unified diff