108 #error Must use C++ for the type Robot
122 using namespace NEWMAT;
141 Link(
const int jt = 0,
const Real it = 0.0,
const Real
id = 0.0,
142 const Real ia = 0.0,
const Real ial = 0.0,
const Real theta_min = -M_PI/2,
143 const Real theta_max = M_PI/2,
const Real it_off = 0.0,
const Real mass = 1.0,
144 const Real cmx = 0.0,
const Real cmy = 0.0,
const Real cmz = 0.0,
145 const Real ixx = 0.0,
const Real ixy = 0.0,
const Real ixz = 0.0,
146 const Real iyy = 0.0,
const Real iyz = 0.0,
const Real izz = 0.0,
147 const Real iIm = 0.0,
const Real iGr = 0.0,
const Real iB = 0.0,
148 const Real iCf = 0.0,
const bool dh =
true,
const bool min_inertial_para =
false,
149 const bool immobile =
false);
151 void transform(
const Real q);
155 Real
get_d(
void)
const {
return d; }
156 Real
get_a(
void)
const {
return a; }
158 Real
get_q(
void)
const;
163 ReturnMatrix
get_r(
void) {
return r; }
164 ReturnMatrix
get_p(
void)
const {
return p; }
165 Real
get_m(
void)
const {
return m; }
168 Real
get_B(
void)
const {
return B; }
170 ReturnMatrix
get_I(
void)
const {
return I; }
172 void set_m(
const Real m_) { m = m_; }
173 void set_mc(
const ColumnVector & mc_);
174 void set_r(
const ColumnVector & r_);
175 void set_Im(
const Real Im_) { Im = Im_; }
176 void set_B(
const Real B_) { B = B_; }
177 void set_Cf(
const Real Cf_) { Cf = Cf_; }
178 void set_I(
const Matrix & I);
216 friend class Robotgl;
217 friend class mRobotgl;
219 Robot_basic(
const int ndof = 1,
const bool dh_parameter =
false,
220 const bool min_inertial_para =
false);
221 Robot_basic(
const Matrix & initrobot_motor,
const bool dh_parameter =
false,
222 const bool min_inertial_para =
false);
223 Robot_basic(
const Matrix & initrobot,
const Matrix & initmotor,
224 const bool dh_parameter =
false,
const bool min_inertial_para =
false);
225 Robot_basic(
const std::string & filename,
const std::string & robotName,
226 const bool dh_parameter =
false,
const bool min_inertial_para =
false);
232 if(i < 1 || i > dof) error(
"i must be 1 <= i <= dof");
233 return links[i].get_q();
235 bool get_DH()
const {
return links[1].DH; }
238 int get_available_dof(
const int endlink)
const;
240 ReturnMatrix get_q(
void)
const;
241 ReturnMatrix get_qp(
void)
const;
242 ReturnMatrix get_qpp(
void)
const;
246 ReturnMatrix get_available_q(
const int endlink)
const;
247 ReturnMatrix get_available_qp(
const int endlink)
const;
248 ReturnMatrix get_available_qpp(
const int endlink)
const;
249 void set_q(
const ColumnVector & q);
250 void set_q(
const Matrix & q);
251 void set_q(
const Real q,
const int i) {
252 if(i < 1 || i > dof) error(
"i must be 1 <= i <= dof");
253 links[i].transform(q);
255 void set_qp(
const ColumnVector & qp);
256 void set_qpp(
const ColumnVector & qpp);
257 void kine(Matrix & Rot, ColumnVector & pos)
const;
258 void kine(Matrix & Rot, ColumnVector & pos,
const int j)
const;
259 ReturnMatrix kine(
void)
const;
260 ReturnMatrix kine(
const int j)
const;
261 ReturnMatrix kine_pd(
const int ref=0)
const;
262 virtual void kine_pd(Matrix & Rot, ColumnVector & pos,
263 ColumnVector & pos_dot,
const int ref)
const=0;
264 virtual void robotType_inv_kin() = 0;
265 virtual ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj = 0);
267 ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj,
268 bool & converge) {
return inv_kin(Tobj,mj,dof,converge);}
269 virtual ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj,
const int endlink,
bool & converge);
270 virtual ReturnMatrix inv_kin_rhino(
const Matrix & Tobj,
bool & converge) = 0;
271 virtual ReturnMatrix inv_kin_puma(
const Matrix & Tobj,
bool & converge) = 0;
272 virtual ReturnMatrix inv_kin_schilling(
const Matrix & Tobj,
bool & converge) = 0;
274 virtual ReturnMatrix jacobian(
const int endlink,
const int ref)
const = 0;
275 virtual ReturnMatrix jacobian_dot(
const int ref=0)
const = 0;
276 ReturnMatrix jacobian_DLS_inv(
const double eps,
const double lambda_max,
const int ref=0)
const;
277 virtual void dTdqi(Matrix & dRot, ColumnVector & dp,
const int i) = 0;
278 virtual ReturnMatrix dTdqi(
const int i) = 0;
279 ReturnMatrix acceleration(
const ColumnVector & q,
const ColumnVector & qp,
280 const ColumnVector & tau);
281 ReturnMatrix acceleration(
const ColumnVector & q,
const ColumnVector & qp,
282 const ColumnVector & tau,
const ColumnVector & Fext,
283 const ColumnVector & Next);
284 ReturnMatrix inertia(
const ColumnVector & q);
285 virtual ReturnMatrix torque_novelocity(
const ColumnVector & qpp) = 0;
286 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
287 const ColumnVector & qpp) = 0;
288 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
289 const ColumnVector & qpp,
290 const ColumnVector & Fext_,
291 const ColumnVector & Next_) = 0;
292 virtual void delta_torque(
const ColumnVector & q,
const ColumnVector & qp,
293 const ColumnVector & qpp,
const ColumnVector & dq,
294 const ColumnVector & dqp,
const ColumnVector & dqpp,
295 ColumnVector & torque, ColumnVector & dtorque) =0;
296 virtual void dq_torque(
const ColumnVector & q,
const ColumnVector & qp,
297 const ColumnVector & qpp,
const ColumnVector & dq,
298 ColumnVector & torque, ColumnVector & dtorque) =0;
299 virtual void dqp_torque(
const ColumnVector & q,
const ColumnVector & qp,
300 const ColumnVector & dqp, ColumnVector & torque,
301 ColumnVector & dtorque) =0;
302 ReturnMatrix dtau_dq(
const ColumnVector & q,
const ColumnVector & qp,
303 const ColumnVector & qpp);
304 ReturnMatrix dtau_dqp(
const ColumnVector & q,
const ColumnVector & qp);
305 virtual ReturnMatrix G() = 0;
306 virtual ReturnMatrix C(
const ColumnVector & qp) = 0;
307 void error(
const std::string & msg1)
const;
309 ColumnVector *w, *wp, *vp, *a, *f, *f_nv, *n, *n_nv, *F, *N, *p, *pp,
310 *dw, *dwp, *dvp, *da, *df, *dn, *dF, *dN, *dp,
317 void cleanUpPointers();
339 Robot(
const int ndof=1);
340 Robot(
const Matrix & initrobot);
341 Robot(
const Matrix & initrobot,
const Matrix & initmotor);
343 Robot(
const std::string & filename,
const std::string & robotName);
345 virtual void robotType_inv_kin();
346 virtual void kine_pd(Matrix & Rot, ColumnVector & pos,
347 ColumnVector & pos_dot,
const int ref)
const;
348 ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj = 0);
349 virtual ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj,
const int endlink,
bool & converge);
350 virtual ReturnMatrix inv_kin_rhino(
const Matrix & Tobj,
bool & converge);
351 virtual ReturnMatrix inv_kin_puma(
const Matrix & Tobj,
bool & converge);
352 virtual ReturnMatrix inv_kin_schilling(
const Matrix & Tobj,
bool & converge);
354 virtual ReturnMatrix jacobian(
const int endlink,
const int ref)
const;
355 virtual ReturnMatrix jacobian_dot(
const int ref=0)
const;
356 virtual void dTdqi(Matrix & dRot, ColumnVector & dp,
const int i);
357 virtual ReturnMatrix dTdqi(
const int i);
358 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
359 const ColumnVector & qpp);
360 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
361 const ColumnVector & qpp,
362 const ColumnVector & Fext_,
363 const ColumnVector & Next_);
364 virtual ReturnMatrix torque_novelocity(
const ColumnVector & qpp);
365 virtual void delta_torque(
const ColumnVector & q,
const ColumnVector & qp,
366 const ColumnVector & qpp,
const ColumnVector & dq,
367 const ColumnVector & dqp,
const ColumnVector & dqpp,
368 ColumnVector & ltorque, ColumnVector & dtorque);
369 virtual void dq_torque(
const ColumnVector & q,
const ColumnVector & qp,
370 const ColumnVector & qpp,
const ColumnVector & dq,
371 ColumnVector & torque, ColumnVector & dtorque);
372 virtual void dqp_torque(
const ColumnVector & q,
const ColumnVector & qp,
373 const ColumnVector & dqp, ColumnVector & torque,
374 ColumnVector & dtorque);
375 virtual ReturnMatrix G();
376 virtual ReturnMatrix C(
const ColumnVector & qp);
388 mRobot(
const Matrix & initrobot_motor);
389 mRobot(
const Matrix & initrobot,
const Matrix & initmotor);
391 mRobot(
const std::string & filename,
const std::string & robotName);
393 virtual void robotType_inv_kin();
394 ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj = 0);
395 virtual ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj,
const int endlink,
bool & converge);
396 virtual ReturnMatrix inv_kin_rhino(
const Matrix & Tobj,
bool & converge);
397 virtual ReturnMatrix inv_kin_puma(
const Matrix & Tobj,
bool & converge);
398 virtual ReturnMatrix inv_kin_schilling(
const Matrix & Tobj,
bool & converge);
399 virtual void kine_pd(Matrix & Rot, ColumnVector & pos,
400 ColumnVector & pos_dot,
const int ref)
const;
402 virtual ReturnMatrix jacobian(
const int endlink,
const int ref)
const;
403 virtual ReturnMatrix jacobian_dot(
const int ref=0)
const;
404 virtual void dTdqi(Matrix & dRot, ColumnVector & dp,
const int i);
405 virtual ReturnMatrix dTdqi(
const int i);
406 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
407 const ColumnVector & qpp);
408 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
409 const ColumnVector & qpp,
410 const ColumnVector & Fext_,
411 const ColumnVector & Next_);
412 virtual ReturnMatrix torque_novelocity(
const ColumnVector & qpp);
413 virtual void delta_torque(
const ColumnVector & q,
const ColumnVector & qp,
414 const ColumnVector & qpp,
const ColumnVector & dq,
415 const ColumnVector & dqp,
const ColumnVector & dqpp,
416 ColumnVector & torque, ColumnVector & dtorque);
417 virtual void dq_torque(
const ColumnVector & q,
const ColumnVector & qp,
418 const ColumnVector & qpp,
const ColumnVector & dq,
419 ColumnVector & torque, ColumnVector & dtorque);
420 virtual void dqp_torque(
const ColumnVector & q,
const ColumnVector & qp,
421 const ColumnVector & dqp, ColumnVector & torque,
422 ColumnVector & dtorque);
423 virtual ReturnMatrix G();
424 virtual ReturnMatrix C(
const ColumnVector & qp);
440 mRobot_min_para(
const std::string & filename,
const std::string & robotName);
442 virtual void robotType_inv_kin();
443 ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj = 0);
444 virtual ReturnMatrix inv_kin(
const Matrix & Tobj,
const int mj,
const int endlink,
bool & converge);
445 virtual ReturnMatrix inv_kin_rhino(
const Matrix & Tobj,
bool & converge);
446 virtual ReturnMatrix inv_kin_puma(
const Matrix & Tobj,
bool & converge);
447 virtual ReturnMatrix inv_kin_schilling(
const Matrix & Tobj,
bool & converge);
448 virtual void kine_pd(Matrix & Rot, ColumnVector & pos,
449 ColumnVector & pos_dot,
const int ref=0)
const;
451 virtual ReturnMatrix jacobian(
const int endlink,
const int ref)
const;
452 virtual ReturnMatrix jacobian_dot(
const int ref=0)
const;
453 virtual void dTdqi(Matrix & dRot, ColumnVector & dp,
const int i);
454 virtual ReturnMatrix dTdqi(
const int i);
455 virtual ReturnMatrix torque(
const ColumnVector & q,
const ColumnVector & qp,
456 const ColumnVector & qpp);
457 virtual ReturnMatrix torque(
const ColumnVector & q,
458 const ColumnVector & qp,
459 const ColumnVector & qpp,
460 const ColumnVector & Fext_,
461 const ColumnVector & Next_);
462 virtual ReturnMatrix torque_novelocity(
const ColumnVector & qpp);
463 virtual void delta_torque(
const ColumnVector & q,
const ColumnVector & qp,
464 const ColumnVector & qpp,
const ColumnVector & dq,
465 const ColumnVector & dqp,
const ColumnVector & dqpp,
466 ColumnVector & torque, ColumnVector & dtorque);
467 virtual void dq_torque(
const ColumnVector & q,
const ColumnVector & qp,
468 const ColumnVector & qpp,
const ColumnVector & dq,
469 ColumnVector & torque, ColumnVector & dtorque);
470 virtual void dqp_torque(
const ColumnVector & q,
const ColumnVector & qp,
471 const ColumnVector & dqp, ColumnVector & torque,
472 ColumnVector & dtorque);
473 virtual ReturnMatrix G();
474 virtual ReturnMatrix C(
const ColumnVector & qp);