-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.html
205 lines (154 loc) · 7.09 KB
/
home.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!--|\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/|
|\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/|
||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/
/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\
KinEval | Kinematic Evaluator | HTML example
Implementation of robot kinematics, control, decision making, and dynamics
in HTML5/JavaScript and threejs
@author ohseejay / https://github.com/ohseejay
/ https://bitbucket.org/ohseejay
Chad Jenkins
Laboratory for Perception RObotics and Grounded REasoning Systems
University of Michigan
License: Michigan Honor License
|\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/|
||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/
/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\
\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\/||\-->
<html>
<head> <meta charset="utf-8"/> </head>
<body style="overflow: hidden">
<!-- //////////////////////////////////////////////////
///// JAVASCRIPT INCLUDES
////////////////////////////////////////////////// -->
<!-- threejs r73 (https://github.com/mrdoob/three.js/) for 3D rendering
<script src="js/three.js"></script>
<script src="js/three_73.min.js"></script>
-->
<script src="js/three_92.min.js"></script>
<!-- threejs camera controls helpers -->
<script src="js/OrbitControls.js"></script>
<!-- threejs keyboard input helper -->
<script src="js/THREEx.KeyboardState.js"></script>
<!-- threejs geometry loading helpers -->
<script src="js/STLLoader_92.js"></script>
<script src="js/ColladaLoader_92.js"></script>
<!--
<script src="js/STLLoader.js"></script>
<script src="js/ColladaLoader2.js"></script>
<script src="js/ColladaLoader.js"></script>
-->
<!-- numericjs (https://github.com/sloisel/numeric) for matrix routines -->
<script src="js/numeric-1.2.6.js"></script>
<!-- dat GUI helper -->
<script src="js/dat.gui.min.js"></script>
<!-- kineval includes -->
<script src="kineval/kineval.js"></script>
<script src="kineval/kineval_startingpoint.js"></script>
<script src="kineval/kineval_robot_init.js"></script>
<script src="kineval/kineval_robot_init_joints.js"></script>
<script src="kineval/kineval_threejs.js"></script>
<script src="kineval/kineval_userinput.js"></script>
<!-- kineval FK/drawing -->
<script src="kineval/kineval_forward_kinematics.js"></script>
<script src="kineval/kineval_matrix.js"></script>
<script src="kineval/kineval_quaternion.js"></script>
<!-- kineval FK/joint control -->
<script src="kineval/kineval_controls.js"></script>
<script src="kineval/kineval_servo_control.js"></script>
<!-- kineval IK -->
<script src="kineval/kineval_inverse_kinematics.js"></script>
<!-- kineval motion planning -->
<script src="kineval/kineval_rrt_connect.js"></script>
<script src="kineval/kineval_collision.js"></script>
<!-- kineval experimental rosbridge/ROS for connectivity to a real robot -->
<script type="text/javascript" src="js/eventemitter2.min.js"></script>
<script type="text/javascript" src="js/roslib.min.js"></script>
<script src="kineval/kineval_rosbridge.js"></script>
<!-- KE: not supported point cloud as JSON version of PCD format -->
<!--
<script src="experimental/point_clouds/three_objects.pcd.js"></script>
<script src="experimental/point_clouds/eight_objects.pcd.js"></script>
-->
<script>
//////////////////////////////////////////////////
///// HANDLE USER PARAMETERS
//////////////////////////////////////////////////
// set KinEval user parameter defaults
var url_params = {
// load robot data object from given source file name
robot:"robot/dance.js",
// load world data object from given source file name
world:"worlds/world_local_minima.js",
// specify floor/map image from given image file name
map_filename: "maps/Cam_Prep-VFX-checkerboard-lens_distortion-1in.jpg"
};
// preload default robot and world
kineval.loadJSFile("robots/dance.js","robot");
kineval.loadJSFile("worlds/world_local_minima.js","world");
//kineval.loadJSFile("worlds/world_empty.js","world");
// parse KinEval parameters from document URL and set defaults
var url_parsed = window.location.href.split("?");
var i;
for (i=1;i<url_parsed.length;i++) {
var param_parsed = url_parsed[i].split("=");
url_params[param_parsed[0]] = param_parsed[1];
if ((param_parsed[0] === "world")||(param_parsed[0] === "robot"))
kineval.loadJSFile(param_parsed[1],param_parsed[0]);
if (param_parsed[0] === "map")
kineval.params.map_filename = param_parsed[1];
}
//////////////////////////////////////////////////
///// MAIN FUNCTION CALLS
//////////////////////////////////////////////////
// start KinEval execution once the page and its resources are loaded
//window.onload = kineval.start;
document.body.onload = kineval.start;
// STUDENT: my_animate is where your robot's controls and movement are updated over time
function my_init() {
song = document.createElement("audio");
song.src = "music/sober.mp3"
kineval.params.dance_sequence_index = [1,2,3];
// the robot im using is in robots/dance.js
// the fsm is located in the servo_control.js
kineval.startingPlaceholderInit(); // a quick and dirty JavaScript tutorial
}
//////////////////////////////////////////////////
///// ANIMATION AND INTERACTION LOOP
//////////////////////////////////////////////////
// STUDENT: my_animate is where your robot's controls and movement are updated over time
function my_animate() {
// set to starting point mode is true as default (initialized in kineval.js)
// set to false once starting forward kinematics project
kineval.params.just_starting = false;
if (kineval.params.just_starting == true) {
startingPlaceholderAnimate();
kineval.robotDraw();
return;
}
// ROBOT DYNAMICS
// update robot configuration from applied robot controls
// (assuming pure kinematics for now)
kineval.applyControls(robot);
// HANDLE USER CONTROLS
// handle user input
kineval.handleUserInput();
// perform forward kinematics placing robot links in space wrt configuration
kineval.robotForwardKinematics();
// determine if robot is currently in collision with world
kineval.robotIsCollision();
// render robot and world in 3D scene
kineval.robotDraw();
// if requested, perform setpoint control with joint servo controllers
kineval.setpointClockMovement(); // simple clock tick movement
kineval.setpointDanceSequence(); // dance routine
kineval.robotArmControllerSetpoint(); // PID controller
kineval.params.update_pd = false; // clear PID request for next iteration
// if requested, perform inverse kinematics control to reach to point
kineval.robotInverseKinematics(kineval.params.ik_target, robot.endeffector.frame, robot.endeffector.position);
// if requested, perform configuration space motion planning to home pose
kineval.planMotionRRTConnect();
}
</script>
</body>
</html>