arm_control_test.cpp 964 Bytes
Newer Older
Sergi Hernandez's avatar
Sergi Hernandez committed
1
2
3
4
#include "arm_control.h"
#include "exceptions.h"
#include <iostream>

Sergi Hernandez's avatar
Sergi Hernandez committed
5
#ifdef PI
6
std::string dyn_device="/dev/ttyUSB0";
Sergi Hernandez's avatar
Sergi Hernandez committed
7
std::string joy_device="/dev/input/js0";
8
std::string imu_device="/dev/ttyAMA0";
Sergi Hernandez's avatar
Sergi Hernandez committed
9
10
11
12
13
14
15
std::string motion_file_path="/home/pi/code/arm_control/src/xml/poses.xml";
#else
std::string dyn_device="/dev/ttyUSB0";
std::string joy_device="/dev/input/js0";
std::string imu_device="/dev/ttyUSB2";
std::string motion_file_path="/home/sergi/Downloads/arm_control/src/xml/poses.xml";
#endif
Sergi Hernandez's avatar
Sergi Hernandez committed
16
17
18
19

int main(int argc, char *argv[])
{
  try{
20
    CArmControl arm(joy_device,imu_device,dyn_device,1000000,6,5,4);
Sergi Hernandez's avatar
Sergi Hernandez committed
21

Sergi Hernandez's avatar
Sergi Hernandez committed
22
    arm.load_poses(motion_file_path);
23
24
    arm.set_max_angles(PAN,130.0,-130.0);
    arm.set_max_torque(PAN,30);
Sergi Hernandez's avatar
Sergi Hernandez committed
25
    arm.set_max_angles(TILT,90.0,-90.0);
26
    arm.set_max_torque(TILT,30);
Sergi Hernandez's avatar
Sergi Hernandez committed
27
    arm.set_max_angles(ROLL,90.0,-90.0);
28
    arm.set_max_torque(ROLL,30);
Sergi Hernandez's avatar
Sergi Hernandez committed
29
30
31
32
33
34
35
 
  
    while(!arm.exit());
  }catch(CException &e){
    std::cout << e.what() << std::endl;
  }
}