1 #ifndef BODY_EXT_H_INCLUDED 2 #define BODY_EXT_H_INCLUDED 4 #include <rtm/idl/BasicDataType.hh> 5 #include <rtm/idl/ExtendedDataTypes.hh> 6 #include "hrpsys/idl/Img.hh" 7 #include "hrpsys/idl/RobotHardwareService.hh" 9 #include <hrpCorba/OpenHRPCommon.hh> 11 #include <rtm/DataFlowComponentBase.h> 15 #include <rtm/idl/BasicDataTypeSkel.h> 16 #include <rtm/idl/ExtendedDataTypesSkel.h> 24 :
public virtual POA_OpenHRP::RobotHardwareService,
25 public virtual PortableServer::RefCountServantBase
30 void getStatus(OpenHRP::RobotHardwareService::RobotState_out rs);
31 void getStatus2(OpenHRP::RobotHardwareService::RobotState2_out rs);
32 CORBA::Boolean
power(
const char* jname, OpenHRP::RobotHardwareService::SwitchStatus ss);
33 CORBA::Boolean
servo(
const char* jname, OpenHRP::RobotHardwareService::SwitchStatus ss);
37 void setJointControlMode(
const char *jname, OpenHRP::RobotHardwareService::JointControlMode jcm);
41 CORBA::Boolean
addJointGroup(
const char* gname,
const OpenHRP::RobotHardwareService::StrSequence& jnames);
42 CORBA::Boolean
readDigitalInput(::OpenHRP::RobotHardwareService::OctSequence_out din);
44 CORBA::Boolean
writeDigitalOutput(const ::OpenHRP::RobotHardwareService::OctSequence& dout);
45 CORBA::Boolean
writeDigitalOutputWithMask(const ::OpenHRP::RobotHardwareService::OctSequence& dout, const ::OpenHRP::RobotHardwareService::OctSequence&
mask);
47 CORBA::Boolean
readDigitalOutput(::OpenHRP::RobotHardwareService::OctSequence_out dout);
49 void setJointInertias(const ::OpenHRP::RobotHardwareService::DblSequence& mns);
66 RTC::ReturnCode_t
setup();
69 std::cout <<
"BodyRTC::onActivated(" << ec_id <<
")" << std::endl;
73 std::cout <<
"BodyRTC::onDeactivated(" << ec_id <<
")" << std::endl;
77 void createInPort(
const std::string &
config);
78 void createOutPort(
const std::string &config);
79 void writeDataPorts(
double time);
83 void getStatus(OpenHRP::RobotHardwareService::RobotState* rs);
84 void getStatus2(OpenHRP::RobotHardwareService::RobotState2* rs);
88 bool names2ids(
const std::vector<std::string> &i_names, std::vector<int> &o_ids);
89 std::vector<int>
getJointGroup(
const char* gname) {
return m_jointGroups[gname]; }
90 int addJointGroup(
const char* gname,
const std::vector<int>jids) { m_jointGroups[gname] = jids;
return 0;}
93 bool power(
int jid,
bool turnon) {power_status[jid] = turnon?OpenHRP::RobotHardwareService::SWITCH_ON:OpenHRP::RobotHardwareService::SWITCH_OFF;
return true; }
94 bool servo(
const char *jname,
bool turnon);
95 bool servo(
int jid,
bool turnon) {servo_status[jid] = turnon?OpenHRP::RobotHardwareService::SWITCH_ON:OpenHRP::RobotHardwareService::SWITCH_OFF;
return true; }
96 bool power(
const char *jname,
bool turnon);
104 int readCalibState(
const int i) {
return (calib_status[i] == OpenHRP::RobotHardwareService::SWITCH_ON); }
105 int readPowerState(
const int i) {
return (power_status[i] == OpenHRP::RobotHardwareService::SWITCH_ON); }
106 int readServoState(
const int i) {
return (servo_status[i] == OpenHRP::RobotHardwareService::SWITCH_ON); }
123 bool checkEmergency(emg_reason &o_reason,
int &o_id);
145 static const char* bodyrtc_spec[];
std::vector< OpenHRP::RobotHardwareService::SwitchStatus > servo_status
hrp::Vector3 m_lastServoOn_p
void setJointControlMode(const char *jname, OpenHRP::RobotHardwareService::JointControlMode jcm)
std::vector< hrp::dvector6 > forces
BodyRTC::emg_reason m_emergencyReason
void setServoErrorLimit(const char *jname, double limit)
void setServoTorqueGainPercentage(const char *jname, double limit)
std::vector< OpenHRP::RobotHardwareService::SwitchStatus > calib_status
void setDisturbanceObserverGain(::CORBA::Double gain)
CORBA::Long lengthDigitalInput()
RobotHardwareServicePort m_service0
void setJointInertias(const ::OpenHRP::RobotHardwareService::DblSequence &mns)
std::vector< int > getJointGroup(const char *gname)
hrp::Matrix33 m_lastServoOn_R
bool power(int jid, bool turnon)
boost::intrusive_ptr< BodyRTC > BodyRTCPtr
png_infop png_charpp name
std::vector< InPortHandlerBase * > m_inports
RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
RTC::CorbaPort m_RobotHardwareServicePort
std::vector< hrp::Vector3 > gyros
int readPowerState(const int i)
CORBA::Boolean readDigitalInput(::OpenHRP::RobotHardwareService::OctSequence_out din)
std::vector< double > commands
static Manager & instance()
bool servo(int jid, bool turnon)
void setRobot(BodyRTC *i_robot)
void setServoGainPercentage(const char *jname, double limit)
int readServoState(const int i)
std::map< std::string, std::vector< int > > m_jointGroups
int addJointGroup(const char *gname, const std::vector< int >jids)
void removeForceSensorOffset()
CORBA::Boolean addJointGroup(const char *gname, const OpenHRP::RobotHardwareService::StrSequence &jnames)
CORBA::Long lengthDigitalOutput()
void calibrateInertiaSensor()
RobotHardwareServicePort()
CORBA::Boolean writeDigitalOutput(const ::OpenHRP::RobotHardwareService::OctSequence &dout)
CORBA::Boolean readDigitalOutput(::OpenHRP::RobotHardwareService::OctSequence_out dout)
ExecutionContextHandle_t UniqueId
png_infop int png_uint_32 mask
void enableDisturbanceObserver()
CORBA::Boolean writeDigitalOutputWithMask(const ::OpenHRP::RobotHardwareService::OctSequence &dout, const ::OpenHRP::RobotHardwareService::OctSequence &mask)
~RobotHardwareServicePort()
std::vector< OutPortHandlerBase * > m_outports
void getStatus2(OpenHRP::RobotHardwareService::RobotState2_out rs)
CORBA::Boolean servo(const char *jname, OpenHRP::RobotHardwareService::SwitchStatus ss)
CORBA::Boolean power(const char *jname, OpenHRP::RobotHardwareService::SwitchStatus ss)
std::vector< double > m_servoErrorLimit
void initializeJointAngle(const char *name, const char *option)
void disableDisturbanceObserver()
std::vector< hrp::Vector3 > accels
void getStatus(OpenHRP::RobotHardwareService::RobotState_out rs)
std::vector< double > angles
std::vector< OpenHRP::RobotHardwareService::SwitchStatus > power_status
CORBA::Boolean setJointInertia(const char *name,::CORBA::Double mn)
RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
int readCalibState(const int i)