-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsmoothLegMotion.cpp
More file actions
92 lines (68 loc) · 2.29 KB
/
smoothLegMotion.cpp
File metadata and controls
92 lines (68 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "include/defs/defs.h"
#include "include/board/board.h"
#include "include/robotController/controllerMessor2.h"
#include "include/robotModel/robotMessor2.h"
#include "include/board/boardDynamixel.h"
#include "3rdParty/dynamixel/dynamixel.h"
#include "3rdParty/dynamixel/dxl_hal.h"
#include <iostream>
#include <stdio.h>
#include <thread>
using namespace std;
using namespace controller;
int main( int argc, const char** argv )
{
try {
vector <float_type> motorSpeed;
for(int i = 0; i < 18; i++ ){
motorSpeed.push_back(10);
}
Board* board = createBoardDynamixel();
std::vector<float_type> position1;
position1.push_back((0*M_PI)/180);
position1.push_back((24*M_PI)/180);
position1.push_back((114*M_PI)/180);
board->setSpeed(motorSpeed);
for(int i=0; i<6; i++)
{
board->setPosition(i, position1);
}
RobotController* controller = createControllerMessor2("controllerMessor2.xml");
float_type speedo = ((ControllerMessor2*)controller)->speedPajak();
//float_type speedo = 15;
char wait;
usleep(1000000);
// cin >> wait;
Mat34 motion1(Mat34::Identity());
Mat34 motion2(Mat34::Identity());
Mat34 motion3(Mat34::Identity());
Mat34 motion4(Mat34::Identity());
Mat34 motion5(Mat34::Identity());
std::vector<Mat34> trajectoryForPlatform;
motion2(1,3)=0.04;
motion3(1,3)=0.04;
motion3(0,3)=0.03;
motion4(0,3)=0.04;
motion4(1,3)=0.03;
motion4(2,3)=0.05;
motion5(2,3)=0.05;
trajectoryForPlatform.push_back(motion1);
trajectoryForPlatform.push_back(motion2);
trajectoryForPlatform.push_back(motion3);
trajectoryForPlatform.push_back(motion4);
trajectoryForPlatform.push_back(motion5);
while(true){
controller->movePlatform(trajectoryForPlatform, speedo);
//if(speedo<30)
//speedo+=5;
};
if (((ControllerMessor2*)controller)->useVisualizer()){
((ControllerMessor2*)controller)->finishVisualizer();
}
}
catch (const std::exception& ex) {
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}