iob.cpp
Go to the documentation of this file.
1 #include <unistd.h>
2 #include <iostream>
3 #include <cstdlib>
4 #include <cstring>
5 #include <vector>
6 #include "iob.h"
7 
8 static std::vector<double> command;
9 static std::vector<std::vector<double> > forces;
10 static std::vector<std::vector<double> > gyros;
11 static std::vector<std::vector<double> > accelerometers;
12 static std::vector<std::vector<double> > attitude_sensors;
13 static std::vector<std::vector<double> > force_offset;
14 static std::vector<std::vector<double> > gyro_offset;
15 static std::vector<std::vector<double> > accel_offset;
16 static std::vector<int> power;
17 static std::vector<int> servo;
18 static bool isLocked = false;
19 static int frame = 0;
20 static timespec g_ts;
21 static long g_period_ns=5000000;
22 
23 #define CHECK_JOINT_ID(id) if ((id) < 0 || (id) >= number_of_joints()) return E_ID
24 #define CHECK_FORCE_SENSOR_ID(id) if ((id) < 0 || (id) >= number_of_force_sensors()) return E_ID
25 #define CHECK_ACCELEROMETER_ID(id) if ((id) < 0 || (id) >= number_of_accelerometers()) return E_ID
26 #define CHECK_GYRO_SENSOR_ID(id) if ((id) < 0 || (id) >= number_of_gyro_sensors()) return E_ID
27 #define CHECK_ATTITUDE_SENSOR_ID(id) if ((id) < 0 || (id) >= number_of_attitude_sensors()) return E_ID
28 
29 #if (defined __APPLE__)
30 #include <mach/mach_time.h>
31 int clock_gettime(clockid_t clk_id, struct timespec *tp)
32 {
33  if (clk_id != CLOCK_MONOTONIC) return -1;
34 
35  uint64_t clk;
36  clk = mach_absolute_time();
37 
38  static mach_timebase_info_data_t info = {0,0};
39  if (info.denom == 0) mach_timebase_info(&info);
40 
41  uint64_t elapsednano = clk * (info.numer / info.denom);
42 
43  tp->tv_sec = elapsednano * 1e-9;
44  tp->tv_nsec = elapsednano - (tp->tv_sec * 1e9);
45  return 0;
46 }
47 
48 #define TIMER_ABSTIME 0
49 int clock_nanosleep(clockid_t clk_id, int flags, struct timespec *tp,
50  struct timespec *remain)
51 {
52  if (clk_id != CLOCK_MONOTONIC || flags != TIMER_ABSTIME) return -1;
53 
54  static mach_timebase_info_data_t info = {0,0};
55  if (info.denom == 0) mach_timebase_info(&info);
56 
57  uint64_t clk = (tp->tv_sec*1e9 + tp->tv_nsec)/(info.numer/info.denom);
58 
59  mach_wait_until(clk);
60  return 0;
61 }
62 #endif
63 
64 
66 {
67  return (int)command.size();
68 }
69 
71 {
72  return (int)forces.size();
73 }
74 
76 {
77  return (int)gyros.size();
78 }
79 
81 {
82  return (int)accelerometers.size();
83 }
84 
86 {
87  return (int)attitude_sensors.size();
88 }
89 
91 {
92  command.resize(num);
93  power.resize(num);
94  servo.resize(num);
95  for (int i=0; i<num; i++){
96  command[i] = power[i] = servo[i] = 0;
97  }
98  return TRUE;
99 }
100 
102 {
103  forces.resize(num);
104  force_offset.resize(num);
105  for (unsigned int i=0; i<forces.size();i++){
106  forces[i].resize(6);
107  force_offset[i].resize(6);
108  for (int j=0; j<6; j++){
109  forces[i][j] = 0;
110  force_offset[i][j] = 0;
111  }
112  }
113  return TRUE;
114 }
115 
117 {
118  gyros.resize(num);
119  gyro_offset.resize(num);
120  for (unsigned int i=0; i<gyros.size();i++){
121  gyros[i].resize(3);
122  gyro_offset[i].resize(3);
123  for (int j=0; j<3; j++){
124  gyros[i][j] = 0.0;
125  gyro_offset[i][j] = 0.0;
126  }
127  }
128  return TRUE;
129 }
130 
132 {
133  accelerometers.resize(num);
134  accel_offset.resize(num);
135  for (unsigned int i=0; i<accelerometers.size();i++){
136  accelerometers[i].resize(3);
137  accel_offset[i].resize(3);
138  for (int j=0; j<3; j++){
139  accelerometers[i][j] = j == 2 ? 9.81 : 0.0;
140  accel_offset[i][j] = 0;
141  }
142  }
143  return TRUE;
144 }
145 
147 {
148  attitude_sensors.resize(num);
149  for (unsigned int i=0; i<attitude_sensors.size();i++){
150  attitude_sensors[i].resize(3);
151  for (int j=0; j<3; j++){
152  attitude_sensors[i][j] = 0.0;
153  }
154  }
155  return TRUE;
156 }
157 
158 int read_power_state(int id, int *s)
159 {
160  CHECK_JOINT_ID(id);
161  *s = power[id];
162  return TRUE;
163 }
164 
165 int write_power_command(int id, int com)
166 {
167  CHECK_JOINT_ID(id);
168  power[id] = com;
169  return TRUE;
170 }
171 
172 int read_power_command(int id, int *com)
173 {
174  CHECK_JOINT_ID(id);
175  *com = power[id];
176  return TRUE;
177 }
178 
179 int read_servo_state(int id, int *s)
180 {
181  CHECK_JOINT_ID(id);
182  *s = servo[id];
183  return TRUE;
184 }
185 
186 int read_servo_alarm(int id, int *a)
187 {
188  CHECK_JOINT_ID(id);
189  *a = 0;
190  return TRUE;
191 }
192 
194 {
195  CHECK_JOINT_ID(id);
196  *s = JCM_POSITION;
197  return TRUE;
198 }
199 
201 {
202  CHECK_JOINT_ID(id);
203  return TRUE;
204 }
205 
206 int read_actual_angle(int id, double *angle)
207 {
208  CHECK_JOINT_ID(id);
209  *angle = command[id]+0.01;
210  return TRUE;
211 }
212 
213 int read_actual_angles(double *angles)
214 {
215  for (int i=0; i<number_of_joints(); i++){
216  angles[i] = command[i]+0.01;
217  }
218  return TRUE;
219 }
220 
221 int read_actual_torques(double *torques)
222 {
223  return FALSE;
224 }
225 
226 int read_command_torque(int id, double *torque)
227 {
228  return FALSE;
229 }
230 
231 int write_command_torque(int id, double torque)
232 {
233  return FALSE;
234 }
235 
236 int read_command_torques(double *torques)
237 {
238  return FALSE;
239 }
240 
241 int write_command_torques(const double *torques)
242 {
243  return FALSE;
244 }
245 
246 int read_command_angle(int id, double *angle)
247 {
248  CHECK_JOINT_ID(id);
249  *angle = command[id];
250  return TRUE;
251 }
252 
253 int write_command_angle(int id, double angle)
254 {
255  CHECK_JOINT_ID(id);
256  command[id] = angle;
257  return TRUE;
258 }
259 
260 int read_command_angles(double *angles)
261 {
262  for (int i=0; i<number_of_joints(); i++){
263  angles[i] = command[i];
264  }
265  return TRUE;
266 }
267 
268 int write_command_angles(const double *angles)
269 {
270  for (int i=0; i<number_of_joints(); i++){
271  command[i] = angles[i];
272  }
273  return TRUE;
274 }
275 
276 int read_pgain(int id, double *gain)
277 {
278  return FALSE;
279 }
280 
281 int write_pgain(int id, double gain)
282 {
283  return FALSE;
284 }
285 
286 int read_dgain(int id, double *gain)
287 {
288  return FALSE;
289 }
290 
291 int write_dgain(int id, double gain)
292 {
293  return FALSE;
294 }
295 
296 int read_force_sensor(int id, double *forces)
297 {
298  for (int i=0; i<6; i++){
299  forces[i] = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*2
300  + 2 + force_offset[id][i]; // 2 = initial offset
301  }
302  return TRUE;
303 }
304 
305 int read_gyro_sensor(int id, double *rates)
306 {
308  for (int i=0; i<3; i++){
309  rates[i] = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.01
310  + 0.01 + gyro_offset[id][i]; // 0.01 = initial offset
311  }
312  return TRUE;
313 }
314 
315 int read_accelerometer(int id, double *accels)
316 {
317  for (int i=0; i<3; i++){
318  double randv = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.01;
319  accels[i] = (i == 2 ? (9.8+randv) : randv)
320  + 0.01 + accel_offset[id][i]; // 0.01 = initial offset
321  }
322  return TRUE;
323 }
324 
325 int read_touch_sensors(unsigned short *onoff)
326 {
327  return FALSE;
328 }
329 
330 int read_attitude_sensor(int id, double *att)
331 {
332  return FALSE;
333 }
334 
335 int read_current(int id, double *mcurrent)
336 {
337  return FALSE;
338 }
339 
340 int read_current_limit(int id, double *v)
341 {
342  return FALSE;
343 }
344 
345 int read_currents(double *currents)
346 {
347  return FALSE;
348 }
349 
350 int read_gauges(double *gauges)
351 {
352  return FALSE;
353 }
354 
355 int read_actual_velocity(int id, double *vel)
356 {
357  return FALSE;
358 }
359 
360 int read_command_velocity(int id, double *vel)
361 {
362  return FALSE;
363 }
364 
365 int write_command_velocity(int id, double vel)
366 {
367  return FALSE;
368 }
369 
370 int read_actual_velocities(double *vels)
371 {
372  return FALSE;
373 }
374 
375 int read_command_velocities(double *vels)
376 {
377  return FALSE;
378 }
379 
380 int write_command_velocities(const double *vels)
381 {
382  return FALSE;
383 }
384 
385 int read_temperature(int id, double *v)
386 {
387  return FALSE;
388 }
389 
390 int write_servo(int id, int com)
391 {
392  servo[id] = com;
393  return TRUE;
394 }
395 
396 int write_dio(unsigned short buf)
397 {
398  return FALSE;
399 }
400 
401 int open_iob(void)
402 {
403  std::cout << "dummy IOB is opened" << std::endl;
404  for (int i=0; i<number_of_joints(); i++){
405  command[i] = 0.0;
406  power[i] = OFF;
407  servo[i] = OFF;
408  }
409  clock_gettime(CLOCK_MONOTONIC, &g_ts);
410  return TRUE;
411 }
412 
413 int close_iob(void)
414 {
415  std::cout << "dummy IOB is closed" << std::endl;
416  return TRUE;
417 }
418 
419 int reset_body(void)
420 {
421  for (int i=0; i<number_of_joints(); i++){
422  power[i] = servo[i] = OFF;
423  }
424  return TRUE;
425 }
426 
427 int joint_calibration(int id, double angle)
428 {
429  return FALSE;
430 }
431 
432 int read_gyro_sensor_offset(int id, double *offset)
433 {
434  for (int i=0; i<3; i++){
435  offset[i] = gyro_offset[id][i];
436  }
437  return TRUE;
438 }
439 
440 int write_gyro_sensor_offset(int id, double *offset)
441 {
442  for (int i=0; i<3; i++){
443  gyro_offset[id][i] = offset[i];
444  }
445  return TRUE;
446 }
447 
448 int read_accelerometer_offset(int id, double *offset)
449 {
450  for (int i=0; i<3; i++){
451  offset[i] = accel_offset[id][i];
452  }
453  return TRUE;
454 }
455 
456 int write_accelerometer_offset(int id, double *offset)
457 {
458  for (int i=0; i<3; i++){
459  accel_offset[id][i] = offset[i];
460  }
461  return TRUE;
462 }
463 
464 int read_force_offset(int id, double *offsets)
465 {
466  for (int i=0; i<6; i++){
467  offsets[i] = force_offset[id][i];
468  }
469  return TRUE;
470 }
471 
472 int write_force_offset(int id, double *offsets)
473 {
474  for (int i=0; i<6; i++){
475  force_offset[id][i] = offsets[i];
476  }
477  return TRUE;
478 }
479 
480 int write_attitude_sensor_offset(int id, double *offset)
481 {
482  return FALSE;
483 }
484 
485 int read_calib_state(int id, int *s)
486 {
487  CHECK_JOINT_ID(id);
488  int v = id/2;
489  *s = v%2==0 ? ON : OFF;
490  return TRUE;
491 }
492 
493 int lock_iob()
494 {
495  if (isLocked) return FALSE;
496 
497  isLocked = true;
498  return TRUE;
499 }
501 {
502  isLocked = false;
503  return TRUE;
504 }
505 
507 {
508  return FALSE;
509 }
510 
511 int read_limit_angle(int id, double *angle)
512 {
513  return FALSE;
514 }
515 
516 int read_angle_offset(int id, double *angle)
517 {
518  return FALSE;
519 }
520 
521 int write_angle_offset(int id, double angle)
522 {
523  return FALSE;
524 }
525 
526 int read_ulimit_angle(int id, double *angle)
527 {
528  return FALSE;
529 }
530 int read_llimit_angle(int id, double *angle)
531 {
532  return FALSE;
533 }
534 int read_encoder_pulse(int id, double *ec)
535 {
536  return FALSE;
537 }
538 int read_gear_ratio(int id, double *gr)
539 {
540  return FALSE;
541 }
542 int read_torque_const(int id, double *tc)
543 {
544  return FALSE;
545 }
546 int read_torque_limit(int id, double *limit)
547 {
548  return FALSE;
549 }
550 
551 unsigned long long read_iob_frame()
552 {
553  ++frame;
554  if (frame == 5) frame = 0;
555  return frame;
556 }
557 
559 {
560  return 5;
561 }
562 
563 int read_power(double *voltage, double *current)
564 {
565  *voltage = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*1+48;
566  *current = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.5+1;
567  return TRUE;
568 }
569 
570 #if defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 2
571 int number_of_batteries()
572 {
573  return 1;
574 }
575 
576 int read_battery(int id, double *voltage, double *current, double *soc)
577 {
578  *voltage = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*1+48;
579  *current = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.5+1;
580  *soc = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.5+50;
581  return TRUE;
582 }
583 
584 int number_of_thermometers()
585 {
586  return 0;
587 }
588 #endif
589 
590 #if defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 3
591 int write_command_acceleration(int id, double acc)
592 {
593  return FALSE;
594 }
595 
596 int write_command_accelerations(const double *accs)
597 {
598  return FALSE;
599 }
600 
601 int write_joint_inertia(int id, double mn)
602 {
603  return FALSE;
604 }
605 
606 int write_joint_inertias(const double *mns)
607 {
608  return FALSE;
609 }
610 
611 int read_pd_controller_torques(double *torques)
612 {
613  return FALSE;
614 }
615 
616 int write_disturbance_observer(int com)
617 {
618  return FALSE;
619 }
620 
621 int write_disturbance_observer_gain(double gain)
622 {
623  return FALSE;
624 }
625 #endif
626 
627 #if defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 4
628 int read_torque_pgain(int id, double *gain)
629 {
630  return FALSE;
631 }
632 
633 int write_torque_pgain(int id, double gain)
634 {
635  return FALSE;
636 }
637 
638 int read_torque_dgain(int id, double *gain)
639 {
640  return FALSE;
641 }
642 
643 int write_torque_dgain(int id, double gain)
644 {
645  return FALSE;
646 }
647 #endif
648 
649 int read_driver_temperature(int id, unsigned char *v)
650 {
651  *v = id * 2;
652  return TRUE;
653 }
654 
655 void timespec_add_ns(timespec *ts, long ns)
656 {
657  ts->tv_nsec += ns;
658  while (ts->tv_nsec > 1e9){
659  ts->tv_sec += 1;
660  ts->tv_nsec -= 1e9;
661  }
662 }
663 
664 double timespec_compare(timespec *ts1, timespec *ts2)
665 {
666  double dts = ts1->tv_sec - ts2->tv_sec;
667  double dtn = ts1->tv_nsec - ts2->tv_nsec;
668  return dts*1e9+dtn;
669 }
670 
672 {
673  clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &g_ts, 0);
675  timespec now;
676  clock_gettime(CLOCK_MONOTONIC, &now);
677  double dt = timespec_compare(&g_ts, &now);
678  if (dt <= 0){
679  //printf("overrun(%d[ms])\n", -dt*1e6);
680  do {
682  }while(timespec_compare(&g_ts, &now)<=0);
683  }
684  return 0;
685 }
686 
688 {
689  return 0;
690 }
691 
692 int read_extra_servo_state(int id, int *state)
693 {
694  return TRUE;
695 }
696 
697 int set_signal_period(long period_ns)
698 {
699  g_period_ns = period_ns;
700  return TRUE;
701 }
702 
704 {
705  return g_period_ns;
706 }
707 
708 int initializeJointAngle(const char *name, const char *option)
709 {
710  sleep(3);
711  return TRUE;
712 }
713 
714 int read_digital_input(char *dinput)
715 {
716  return FALSE;
717 }
718 
720 {
721  return 0;
722 }
723 
724 int write_digital_output(const char *doutput)
725 {
726  return FALSE;
727 }
728 
729 int write_digital_output_with_mask(const char *doutput, const char *mask)
730 {
731  return FALSE;
732 }
733 
735 {
736  return 0;
737 }
738 
739 int read_digital_output(char *doutput)
740 {
741  return FALSE;
742 }
743 
744 
int write_dgain(int id, double gain)
write D gain[Nm/(rad/s)]
Definition: iob.cpp:291
int read_servo_state(int id, int *s)
read servo status
Definition: iob.cpp:179
int read_attitude_sensor(int id, double *att)
read output of attitude sensor
Definition: iob.cpp:330
int read_llimit_angle(int id, double *angle)
Definition: iob.cpp:530
static std::vector< std::vector< double > > attitude_sensors
Definition: iob.cpp:12
int write_power_command(int id, int com)
turn on/off power supply for motor driver
Definition: iob.cpp:165
int read_command_angle(int id, double *angle)
read command angle[rad]
Definition: iob.cpp:246
int set_number_of_gyro_sensors(int num)
set the number of gyro sensors
Definition: iob.cpp:116
int read_dgain(int id, double *gain)
read D gain[Nm/(rad/s)]
Definition: iob.cpp:286
int read_calib_state(int id, int *s)
read callibration state of joint
Definition: iob.cpp:485
int set_number_of_attitude_sensors(int num)
Definition: iob.cpp:146
static std::vector< std::vector< double > > gyro_offset
Definition: iob.cpp:14
static std::vector< std::vector< double > > forces
Definition: iob.cpp:9
#define FALSE
Definition: iob.h:19
unsigned int sleep(unsigned int seconds)
int read_command_torques(double *torques)
read array of command torques[Nm]
Definition: iob.cpp:236
int read_currents(double *currents)
Definition: iob.cpp:345
static long g_period_ns
Definition: iob.cpp:21
int read_extra_servo_state(int id, int *state)
read extra servo states
Definition: iob.cpp:692
int write_dio(unsigned short buf)
Definition: iob.cpp:396
int write_digital_output_with_mask(const char *doutput, const char *mask)
write_digital_output, non-applicable bits are nop
Definition: iob.cpp:729
static std::vector< std::vector< double > > force_offset
Definition: iob.cpp:13
int read_gyro_sensor_offset(int id, double *offset)
read offset values for gyro sensor output
Definition: iob.cpp:432
int read_control_mode(int id, joint_control_mode *s)
read joint control mode
Definition: iob.cpp:193
int write_angle_offset(int id, double angle)
write offset value for joint[rad]
Definition: iob.cpp:521
int close_iob(void)
close connection with joint servo process
Definition: iob.cpp:413
int read_force_sensor(int id, double *forces)
read output of force sensor
Definition: iob.cpp:296
abstract interface for the robot hardware
int read_torque_limit(int id, double *limit)
Definition: iob.cpp:546
int number_of_accelerometers()
get the number of accelerometers
Definition: iob.cpp:80
int read_power(double *voltage, double *current)
read status of power source
Definition: iob.cpp:563
int read_angle_offset(int id, double *angle)
read offset value for joint[rad]
Definition: iob.cpp:516
static std::vector< std::vector< double > > gyros
Definition: iob.cpp:10
static std::vector< std::vector< double > > accelerometers
Definition: iob.cpp:11
int number_of_gyro_sensors()
get the number of gyro sensors
Definition: iob.cpp:75
png_uint_32 i
int read_actual_angle(int id, double *angle)
read current joint angle[rad]
Definition: iob.cpp:206
int open_iob(void)
open connection with joint servo process
Definition: iob.cpp:401
int write_command_torque(int id, double torque)
write command torque[Nm]
Definition: iob.cpp:231
int write_control_mode(int id, joint_control_mode s)
write joint control mode
Definition: iob.cpp:200
int length_digital_input()
get_digital_input_length
Definition: iob.cpp:719
int write_gyro_sensor_offset(int id, double *offset)
write offset values for gyro sensor output
Definition: iob.cpp:440
png_uint_32 int flags
size_t length_of_extra_servo_state(int id)
get length of extra servo states
Definition: iob.cpp:687
int length_digital_output()
get_digital_output_length
Definition: iob.cpp:734
#define CHECK_JOINT_ID(id)
Definition: iob.cpp:23
int read_encoder_pulse(int id, double *ec)
Definition: iob.cpp:534
int read_force_offset(int id, double *offsets)
read offset values for force sensor output
Definition: iob.cpp:464
#define CHECK_GYRO_SENSOR_ID(id)
Definition: iob.cpp:26
int read_ulimit_angle(int id, double *angle)
Definition: iob.cpp:526
int read_power_state(int id, int *s)
read power status of motor driver
Definition: iob.cpp:158
static int frame
Definition: iob.cpp:19
int read_command_angles(double *angles)
read array of command angles[rad]
Definition: iob.cpp:260
int write_pgain(int id, double gain)
write P gain[Nm/rad]
Definition: iob.cpp:281
int set_number_of_accelerometers(int num)
set the number of accelerometers
Definition: iob.cpp:131
void timespec_add_ns(timespec *ts, long ns)
Definition: iob.cpp:655
::pid_t pid_t
int write_attitude_sensor_offset(int id, double *offset)
Definition: iob.cpp:480
int reset_body(void)
Definition: iob.cpp:419
def j(str, encoding="cp932")
int read_torque_const(int id, double *tc)
Definition: iob.cpp:542
unsigned long long read_iob_frame()
Definition: iob.cpp:551
int write_digital_output(const char *doutput)
write_digital_output, non-applicable bits are nop
Definition: iob.cpp:724
int read_actual_velocities(double *vels)
read actual angular velocities[rad/s]
Definition: iob.cpp:370
int read_gyro_sensor(int id, double *rates)
read output of gyro sensor
Definition: iob.cpp:305
int read_lock_owner(pid_t *pid)
read id of the process whic is locking access to iob
Definition: iob.cpp:506
int number_of_force_sensors()
get the number of force sensors
Definition: iob.cpp:70
int wait_for_iob_signal()
wait until iob signal is issued
Definition: iob.cpp:671
int number_of_joints()
get the number of joints
Definition: iob.cpp:65
int read_driver_temperature(int id, unsigned char *v)
read temperature of motor driver[Celsius]
Definition: iob.cpp:649
int set_signal_period(long period_ns)
set the period of signals issued by wait_for_iob_signal()
Definition: iob.cpp:697
static timespec g_ts
Definition: iob.cpp:20
int unlock_iob()
unlock access to iob
Definition: iob.cpp:500
int read_power_command(int id, int *com)
turn on/off power supply for motor driver
Definition: iob.cpp:172
int read_temperature(int id, double *v)
read thermometer
Definition: iob.cpp:385
static std::vector< int > servo
Definition: iob.cpp:17
int read_accelerometer(int id, double *accels)
read output of accelerometer
Definition: iob.cpp:315
#define TRUE
Definition: iob.h:23
int write_force_offset(int id, double *offsets)
write offset values for force sensor output
Definition: iob.cpp:472
int write_command_velocity(int id, double vel)
write command angular velocity[rad/s]
Definition: iob.cpp:365
long get_signal_period()
get the period of signals issued by wait_for_iob_signal()
Definition: iob.cpp:703
int read_actual_velocity(int id, double *vel)
read actual angular velocity[rad/s]
Definition: iob.cpp:355
position control
Definition: iob.h:63
backing_store_ptr info
int joint_calibration(int id, double angle)
Definition: iob.cpp:427
joint_control_mode
Definition: iob.h:61
int number_of_attitude_sensors()
get the number of attitude sensors
Definition: iob.cpp:85
int read_current(int id, double *mcurrent)
Definition: iob.cpp:335
int read_servo_alarm(int id, int *a)
read servo alarms
Definition: iob.cpp:186
int read_command_velocities(double *vels)
read command angular velocities[rad/s]
Definition: iob.cpp:375
int read_digital_output(char *doutput)
read_digital_output, non-applicable bits are nop
Definition: iob.cpp:739
static int id
int read_command_torque(int id, double *torque)
read command torque[Nm]
Definition: iob.cpp:226
int number_of_substeps()
Definition: iob.cpp:558
int read_command_velocity(int id, double *vel)
read command angular velocity[rad/s]
Definition: iob.cpp:360
static std::vector< int > power
Definition: iob.cpp:16
int read_limit_angle(int id, double *angle)
Definition: iob.cpp:511
int read_digital_input(char *dinput)
read_digital_input, non-applicable bits are nop
Definition: iob.cpp:714
int initializeJointAngle(const char *name, const char *option)
initialize joint angle
Definition: iob.cpp:708
int set_number_of_joints(int num)
set the number of joints
Definition: iob.cpp:90
int lock_iob()
lock access to iob
Definition: iob.cpp:493
static bool isLocked
Definition: iob.cpp:18
static std::vector< double > command
Definition: iob.cpp:8
int write_servo(int id, int com)
turn on/off joint servo
Definition: iob.cpp:390
int read_accelerometer_offset(int id, double *offset)
read offset values for accelerometer output
Definition: iob.cpp:448
#define OFF
Definition: iob.h:9
#define ON
Definition: iob.h:8
int read_touch_sensors(unsigned short *onoff)
Definition: iob.cpp:325
int set_number_of_force_sensors(int num)
set the number of force sensors
Definition: iob.cpp:101
int read_gear_ratio(int id, double *gr)
Definition: iob.cpp:538
double timespec_compare(timespec *ts1, timespec *ts2)
Definition: iob.cpp:664
int write_command_velocities(const double *vels)
write command angular velocities[rad/s]
Definition: iob.cpp:380
int read_current_limit(int id, double *v)
Definition: iob.cpp:340
int read_gauges(double *gauges)
Definition: iob.cpp:350
static std::vector< std::vector< double > > accel_offset
Definition: iob.cpp:15
int write_command_angle(int id, double angle)
write command angle[rad]
Definition: iob.cpp:253
int read_actual_angles(double *angles)
read array of current joint angles[rad]
Definition: iob.cpp:213
int write_command_torques(const double *torques)
write array of command torques[Nm]
Definition: iob.cpp:241
int write_command_angles(const double *angles)
write array of command angles[rad]
Definition: iob.cpp:268
int read_actual_torques(double *torques)
read array of current joint torques[Nm]
Definition: iob.cpp:221
int read_pgain(int id, double *gain)
read P gain[Nm/rad]
Definition: iob.cpp:276
int write_accelerometer_offset(int id, double *offset)
write offset values for accelerometer output
Definition: iob.cpp:456


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50