Go to the documentation of this file.00001 #include "robot.h"
00002 #include "hrpsys/util/Hrpsys.h"
00003 #include <iostream>
00004
00005 #define DEFAULT_ANGLE_ERROR_LIMIT (0.2 - 0.02) // [rad]
00006
00007
00008
00009 robot::robot() {
00010 }
00011 robot::~robot() {
00012 }
00013 bool robot::init() {
00014 m_servoErrorLimit.resize(numJoints());
00015 for (unsigned int i=0; i<numJoints(); i++){
00016 m_servoErrorLimit[i] = DEFAULT_ANGLE_ERROR_LIMIT;
00017 }
00018 return true;
00019 }
00020
00021 bool robot::setServoErrorLimit(const char *i_jname, double i_limit) {
00022 hrp::Link *l = NULL;
00023 if (strcmp(i_jname, "all") == 0 || strcmp(i_jname, "ALL") == 0){
00024 for (unsigned int i=0; i<numJoints(); i++){
00025 m_servoErrorLimit[i] = i_limit;
00026 }
00027 std::cerr << "[el] setServoErrorLimit " << i_limit << "[rad] for all joints" << std::endl;
00028 }else if ((l = link(i_jname))){
00029 m_servoErrorLimit[l->jointId] = i_limit;
00030 std::cerr << "[el] setServoErrorLimit " << i_limit << "[rad] for " << i_jname << std::endl;
00031 }else{
00032 std::cerr << "[el] Invalid joint name of setServoErrorLimit " << i_jname << "!" << std::endl;
00033 return false;
00034 }
00035 return true;
00036 }