qa_player_setmotor.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <blackboard/remote.h>
00024 #include <interfaces/MotorInterface.h>
00025
00026 #include <unistd.h>
00027 #include <cstdio>
00028
00029 using namespace fawkes;
00030
00031 int
00032 main(int argc, char **argv)
00033 {
00034 BlackBoard *bb = new RemoteBlackBoard("localhost", 1910);
00035
00036 MotorInterface *motor = bb->open_for_reading<MotorInterface>("Player Motor");
00037 motor->read();
00038
00039 printf("Motor x=%f y=%f z=%f\n",
00040 motor->odometry_position_x(), motor->odometry_position_y(),
00041 motor->odometry_orientation());
00042
00043 printf("Setting relative (2, 0, 0), this is (%f, %f, %f) global\n",
00044 motor->odometry_position_x() + 2, motor->odometry_position_y(),
00045 motor->odometry_orientation());
00046
00047 motor->msgq_enqueue(new MotorInterface::GotoMessage(motor->odometry_position_x() + 2,
00048 motor->odometry_position_y(),
00049 motor->odometry_orientation(),
00050 1 ));
00051
00052 bb->close(motor);
00053
00054 delete bb;
00055 return 0;
00056 }