30 #include <hrpsys/io/iob.h> 33 #define JID_INVALID -2 38 #define CHECK_JOINT_ID(id) if((id) < 0 || (id) >= number_of_joints()) return E_ID 39 #define CHECK_JOINT_ID_DOF(id) if((id) < 0 || (id) >= DOF) return E_ID 504 if (nxifv1 == NULL) {
505 void *
lib = dlopen(
"libNxOpenCore.so", RTLD_LOCAL|RTLD_NOW);
507 std::fprintf(stdout,
"** failed in dlopen(libNxOpenCore.so): %s\n", dlerror());
512 bool (*
check)(
const char *);
513 check =
reinterpret_cast<bool (*)(
const char *)
>(dlsym(lib,
"nextage_open_supported"));
515 std::fprintf(stdout,
"** failed to find nextage_open_supported(): %s\n", dlerror());
520 if (
check(
"v1.0")==
false) {
521 std::fprintf(stdout,
"** v1.0 not supported\n");
529 std::fprintf(stdout,
"** failed to find nextage_open_getIFv10(): %s\n", dlerror());
535 if (nxifv1 == NULL) {
536 std::fprintf(stdout,
"** failed to getIF()\n");
542 std::fprintf(stdout,
"open_iob - NEXTAGE OPEN I/F v1 instance at 0x%x\n", nxifv1);
547 std::fprintf(stdout,
"open_iob - NEXTAGE OPEN I/F instance is not NULL, ignored\n");
563 if (nxifv1 != NULL) {
569 std::fprintf(stdout,
"close_iob(): nxifv1 is NULL\n");
int write_dgain(int id, double gain)
virtual int read_driver_temperature(int id, unsigned char *v)=0
int read_servo_state(int id, int *s)
virtual int read_lock_owner(pid_t *pid)=0
int read_attitude_sensor(int id, double *att)
int read_actual_torque(int id, double *angle)
int write_power_command(int id, int com)
int read_command_angle(int id, double *angle)
int set_number_of_gyro_sensors(int num)
int read_dgain(int id, double *gain)
int read_calib_state(int id, int *s)
virtual int read_power_state(int id, int *s)=0
int read_command_torques(double *torques)
int read_extra_servo_state(int id, int *state)
virtual int length_digital_input(void)=0
int write_digital_output_with_mask(const char *doutput, const char *mask)
virtual int read_power_command(int id, int *com)=0
int read_gyro_sensor_offset(int id, double *offset)
int read_control_mode(int id, joint_control_mode *s)
int write_angle_offset(int id, double angle)
int read_force_sensor(int id, double *forces)
int number_of_accelerometers()
virtual int read_servo_alarm(int id, int *a)=0
virtual int unlock_iob(void)=0
int read_power(double *voltage, double *current)
virtual int write_digital_output(const char *doutput)=0
int read_angle_offset(int id, double *angle)
virtual int open_iob(void)=0
int number_of_gyro_sensors()
virtual int number_of_substeps(void)=0
int read_actual_angle(int id, double *angle)
int write_command_torque(int id, double torque)
int write_control_mode(int id, joint_control_mode s)
int length_digital_input()
int write_gyro_sensor_offset(int id, double *offset)
virtual int initializeJointAngle(const char *name, const char *option)=0
virtual int write_servo(int id, int com)=0
size_t length_of_extra_servo_state(int id)
int length_digital_output()
virtual int read_command_angles(double *angles)=0
int read_force_offset(int id, double *offsets)
int read_power_state(int id, int *s)
int read_command_angles(double *angles)
int write_pgain(int id, double gain)
virtual int read_actual_angle(int id, double *angle)=0
int set_number_of_accelerometers(int num)
int read_digital_input(char *dIn)
virtual int read_calib_state(int id, int *s)=0
int write_attitude_sensor_offset(int id, double *offset)
virtual int write_command_angles(const double *angles)=0
virtual int read_digital_input(char *dIn)=0
unsigned long long read_iob_frame()
virtual int lock_iob(void)=0
int write_digital_output(const char *doutput)
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
virtual int close_iob(void)=0
virtual int read_command_angle(int id, double *angle)=0
int read_actual_velocities(double *vels)
int read_gyro_sensor(int id, double *rates)
virtual unsigned long long read_iob_frame(void)=0
int read_lock_owner(pid_t *pid)
int number_of_force_sensors()
int wait_for_iob_signal()
virtual int write_power_command(int id, int com)=0
int read_driver_temperature(int id, unsigned char *v)
int set_signal_period(long period_ns)
set the period of signals issued by wait_for_iob_signal()
static NEXTAGE_OPEN::OpenIFv10 * nxifv1
int read_power_command(int id, int *com)
virtual int read_digital_output(char *doutput)=0
int read_temperature(int id, double *v)
int read_accelerometer(int id, double *accels)
virtual int read_power(double *voltage, double *current)=0
virtual int wait_for_iob_signal(void)=0
int write_force_offset(int id, double *offsets)
virtual long get_signal_period(void)=0
int write_command_velocity(int id, double vel)
virtual int length_digital_output(void)=0
long get_signal_period()
get the period of signals issued by wait_for_iob_signal()
int read_actual_velocity(int id, double *vel)
int number_of_attitude_sensors()
virtual int write_command_angle(int id, double angle)=0
int read_servo_alarm(int id, int *a)
int read_command_velocities(double *vels)
int read_digital_output(char *doutput)
int read_command_torque(int id, double *torque)
int read_command_velocity(int id, double *vel)
virtual int read_servo_state(int id, int *s)=0
virtual int reset_body(void)=0
int initializeJointAngle(const char *name, const char *option)
int set_number_of_joints(int num)
int write_servo(int id, int com)
int read_accelerometer_offset(int id, double *offset)
int set_number_of_force_sensors(int num)
static pthread_mutex_t openLock
int write_command_velocities(const double *vels)
virtual int read_actual_angles(double *angles)=0
int write_command_angle(int id, double angle)
int read_actual_angles(double *angles)
virtual int write_digital_output_with_mask(const char *doutput, const char *mask)=0
int write_command_torques(const double *torques)
int write_command_angles(const double *angles)
int read_actual_torques(double *torques)
int read_pgain(int id, double *gain)
int write_accelerometer_offset(int id, double *offset)