1 #include <libplayerc++/playerc++.h>
9 using namespace PlayerCc;
14 PlayerClient robot(PlayerCc::PLAYER_HOSTNAME, PlayerCc::PLAYER_PORTNUM);
17 ActArrayProxy ap_l(&robot, 0);
18 ActArrayProxy ap_r(&robot, 1);
19 ActArrayProxy ap_c(&robot, 2);
20 ActArrayProxy ap_s(&robot, 3);
21 ActArrayProxy ap_h(&robot, 4);
23 Position2dProxy flc(&robot, 0);
24 Position2dProxy frc(&robot, 1);
25 Position2dProxy rlc(&robot, 2);
26 Position2dProxy rrc(&robot, 3);
29 std::cout << robot << std::endl;
31 flc.SetMotorEnable(
true);
32 frc.SetMotorEnable(
true);
33 rlc.SetMotorEnable(
true);
34 rrc.SetMotorEnable(
true);
46 ap_h.MoveTo(0, -M_PI/4.0);
47 ap_h.MoveTo(1, M_PI/6.0);
48 ap_h.MoveTo(2, -M_PI/4.0);
49 ap_h.MoveTo(3, M_PI/5.0);
50 ap_h.MoveTo(4, -M_PI/3.0);
51 ap_h.MoveTo(5, -M_PI/5.0);
52 ap_h.MoveTo(6, M_PI/4.0);
54 ap_l.MoveTo(0, M_PI/4.0);
55 ap_l.MoveTo(1, M_PI/4.0);
56 ap_l.MoveTo(2, M_PI/4.0);
57 ap_l.MoveTo(3, M_PI/5.0);
58 ap_l.MoveTo(4, M_PI/3.0);
59 ap_l.MoveTo(5, M_PI/2.0);
60 ap_l.MoveTo(6, M_PI/1.0);
62 ap_r.MoveTo(0, -M_PI/3.0);
63 ap_r.MoveTo(1, -M_PI/3.0);
64 ap_r.MoveTo(2, -M_PI/3.0);
65 ap_r.MoveTo(3, -M_PI/2.0);
66 ap_r.MoveTo(4, -M_PI/3.0);
67 ap_r.MoveTo(5, -M_PI/1.0);
68 ap_r.MoveTo(6, -M_PI/2.0);
70 ap_c.MoveTo(0, - M_PI/4.0);
71 ap_c.MoveTo(1, -3.0*M_PI/4.0);
72 ap_c.MoveTo(2, M_PI/4.0);
73 ap_c.MoveTo(3, 3.0*M_PI/4.0);
77 player_actarray_actuator_t data0 = ap_l.GetActuatorData(0);
78 printf(
"0 Pos[%f] Speed[%f]\n",data0.position, data0.speed);
79 player_actarray_actuator_t data1 = ap_l.GetActuatorData(1);
80 printf(
"1 Pos[%f] Speed[%f]\n",data1.position, data1.speed);
81 player_actarray_actuator_t data2 = ap_l.GetActuatorData(2);
82 printf(
"2 Pos[%f] Speed[%f]\n",data2.position, data2.speed);
85 catch (PlayerCc::PlayerError e)
87 std::cerr <<
"Error:" << e << std::endl;