“”” hrpsys interface functions “”“

class hrpsys_config.HrpsysConfigurator(cname='[hrpsys.py] ')
Groups = []
abc = None
activateComps()
checkEncoders(jname='all', option='')

Run the encoder checking sequence for specified joints, run goActual and turn on servos.

@type jname: str @param jname: The value ‘all’ works iteratively for all servos. @type option: str @param option: Possible values are follows (w/o double quote): “-overwrite”: Overwrite calibration value.

checkSimulationMode()
clear()
clearLog()
clearOfGroup(gname, tm=0.0)
co = None
co_svc = None
connectComps()
connectLoggerPort(artc, sen_name, log_name=None)
createComp(compName, instanceName)
createComps()
el = None
el_svc = None
ep_svc = None
findComp(compName, instanceName, max_timeout_count=10)
findComps()
findModelLoader()
fk = None
fk_svc = None
flat2Groups(flatList)

@type flatList: [] @param flatList: single dimension list with its length of 15 @rtype: [[]] @return: 2-dimensional list of Groups.

gc = None
gc_svc = None
getActualState()

@return: This returns actual states of ther robot, which is defined in RobotHardware.idl (https://hrpsys-base.googlecode.com/svn/trunk/idl/RobotHardwareService.idl)

/**
  • @brief status of the robot

*/

struct RobotState {

DblSequence angle; ///< current joint angles[rad] DblSequence command;///< reference joint angles[rad] DblSequence torque; ///< joint torques[Nm] /**

  • @brief servo statuses(32bit+extra states)

  • 0: calib status ( 1 => done )

  • 1: servo status ( 1 => on )

  • 2: power status ( 1 => supplied )

  • 3-18: servo alarms (see @ref iob.h)

  • 19-23: unused
    • 24-31: driver temperature (deg)

*/

LongSequenceSequence servoState; sequence<DblSequence6> force; ///< forces[N] and torques[Nm] sequence<DblSequence3> rateGyro; ///< angular velocities[rad/s] sequence<DblSequence3> accel; ///< accelerations[m/(s^2)] double voltage; ///< voltage of power supply[V] double current; ///< current[A]

};

getBodyInfo(url)
getCurrentPose(lname=None)

@type jointname: str @rtype: List of float @return: Rotational matrix and the position of the given joint in

1-dimensional list, that is:

[a11, a12, a13, x,

a21, a22, a23, y, a31, a32, a33, z,

0, 0, 0, 1]
getCurrentPosition(lname=None)

@type jointname: str @rtype: List of float @return: List of x, y, z positions about the specified joint.

getCurrentRPY(lname)

@type jointname: str @rtype: List of float @return: List of orientation in rpy form about the specified joint.

getCurrentRotation(lname)

@type jointname: str @rtype: List of float @return: Rotational matrix of the given joint in 2-dimensional list,

that is: [[a11, a12, a13],

[a21, a22, a23], [a31, a32, a33]]
getJointAngleControllerList()
getJointAngles()
getRTCInstanceList()
getRTCList()

@rtype [[str]] @rerutrn List of available components. Each element consists of a list

of abbreviated and full names of the component.
getRTCListUnstable()

@rtype [[str]] @rerutrn List of available unstable components. Each element consists

of a list of abbreviated and full names of the component.
getReferencePose(lname)

This returns reference(commanded) value, and getCurrentPose returns current(actual) value

@rtype: List of float @return: Rotational matrix and the position of the given joint in

1-dimensional list, that is:

[a11, a12, a13, x,

a21, a22, a23, y, a31, a32, a33, z,

0, 0, 0, 1]
getReferencePosition(lname)

@rtype: List of float @return: List of angles (degree) of all joints, in the order defined

in the member variable ‘Groups’ (eg. chest, head1, head2, ..).
getReferenceRPY(lname)

This seturns reference(commanded) value, and getCurrentRPY returns current(actual) value

@type jointname: str @rtype: List of float @return: List of orientation in rpy form about the specified joint.

getReferenceRotation(lname)

This seturns reference(commanded) value, and getCurrentRotation returns current(actual) value

@type jointname: str @rtype: List of float @return: Rotational matrix of the given joint in 2-dimensional list,

that is: [[a11, a12, a13],

[a21, a22, a23], [a31, a32, a33]]
getSensors(url)
goActual()

Reset reference joint agnles with actual joint angle values

hgc = None
ic = None
init(robotname='Robot', url='')

Calls init from its superclass, which tries to connect RTCManager, looks for ModelLoader, and starts necessary RTC components. Also runs config, logger. Also internally calls setSelfGroups().

@type robotname: str @type url: str

isCalibDone()

Check whether joints have been calibrated. @rtype bool

isServoOn(jname='any')

Check whether servo control has been turned on. @type jname: str @param jname: Name of a link (that can be obtained by “hiro.Groups”

as lists of groups).

@rtype bool

kf = None
lengthDigitalInput()
lengthDigitalOutput()
loadPattern(fname, tm)
log = None
log_svc = None
ms = None
readDigitalInput()

@return: TODO: elaborate

rh = None
rh_svc = None
rmfo = None
saveLog(fname='sample')
sensors = None
seq = None
seq_svc = None
servoOff(jname='all', wait=True)

@type jname: str @param jname: The value ‘all’ works iteratively for all servos. @type wait: bool @rtype: int @return: 1 = all arm servo off. 2 = all servo on arms and hands off.

-1 = Something wrong happened.
servoOn(jname='all', destroy=1, tm=3)

Turn on/off servos. Joints need to be calibrated (otherwise error returns).

@type jname: str @param jname: The value ‘all’ works iteratively for all servos. @param destroy: Not used. @type tm: float @param tm: Second to complete. @rtype: int @return: 1 or -1 indicating success or failure, respectively.

setJointAngle(jname, angle, tm)

Set angle to the given joint.

NOTE-1: It’s known that this method does not do anything after
some group operation is done. TODO: at least need elaborated to warn users.

NOTE-2: that while this method does not check angle value range, any joints could emit position limit over error, which has not yet been thrown by hrpsys so that there’s no way to catch on this client side. Worthwhile opening an enhancement ticket for that at hironx’ designated issue tracker.

@type jname: str @type angle: float @param angle: In degree. @type tm: float @param tm: Time to complete.

setJointAngles(angles, tm)

NOTE-1: that while this method does not check angle value range, any joints could emit position limit over error, which has not yet been thrown by hrpsys so that there’s no way to catch on this client side. Worthwhile opening an enhancement ticket for that at hironx’ designated issue tracker.

@type angles: float @param angles: In degree. @type tm: float @param tm: Time to complete.

setJointAnglesOfGroup(gname, pose, tm, wait=True)

Note that while this method does not check angle value range, any joints could emit position limit over error, which has not yet been handled in hrpsys so that there’s no way to catch on this client class level. Please consider opening an enhancement ticket for that at hironx’ designated issue tracker.

@type gname: str @param gname: Name of joint group. @type pose: [float] @param pose: list of positions and orientations @type tm: float @param tm: Time to complete. @type wait: bool @param wait: If true, SequencePlayer.waitInterpolationOfGroup gets run.

(TODO: Elaborate what this means...Even after having taken a look at its source code I can’t tell exactly what it means)
setSelfGroups()

Set to the hrpsys.SequencePlayer the groups of links and joints that are statically defined as member variables (Groups) within this class.

setTargetPose(gname, pos, rpy, tm, frame_name=None)

Set absolute pose to a joint. All d* arguments are in meter.

@param gname: Name of the joint group. @type pos: float @type rpy: TODO: ?? @rtype: bool

setTargetPoseRelative(gname, eename, dx=0, dy=0, dz=0, dr=0, dp=0, dw=0, tm=10, wait=True)

Set angles to a joint group relative to its current pose. All d* arguments are in meter.

@param gname: Name of the joint group. @param eename: Name of the link. @rtype: bool

setupLogger()
sh = None
sh_svc = None
simulation_mode = None
st = None
tc = None
tc_svc = None
te = None
te_svc = None
tf = None
tl = None
tl_svc = None
vs = None
waitForModelLoader()
waitForRTCManager(managerhost=None)
waitForRTCManagerAndRoboHardware(robotname='Robot', managerhost=None)
waitForRobotHardware(robotname='Robot')
waitInterpolation()
waitInterpolationOfGroup(gname)

Lets SequencePlayer wait until the movement currently happening to finish. @see: http://wiki.ros.org/joint_trajectory_action. This method

corresponds to JointTrajectoryGoal in ROS.

@type groupname: str

writeDigitalOutput(dout)

@type dout: [int] @param dout: List of bits. Length might defer depending on

robot’s implementation.

@return: What RobotHardware.writeDigitalOutput returns (TODO: document)

writeDigitalOutputWithMask(dout, mask)

@type dout: [int] @param dout: List of bits. Length might defer depending on robot’s

implementation.

@type mask: [int] @param mask: List of masking bits. Length depends on that of dout. @return: What RobotHardware.writeDigitalOutput returns (TODO: document)

hrpsys_config.euler_from_matrix(matrix, axes='sxyz')

Return Euler angles from rotation matrix for specified axis sequence.

axes : One of 24 axis sequences as string or encoded tuple

Note that many Euler angle triplets can describe one matrix.

>>> R0 = euler_matrix(1, 2, 3, 'syxz')
>>> al, be, ga = euler_from_matrix(R0, 'syxz')
>>> R1 = euler_matrix(al, be, ga, 'syxz')
>>> numpy.allclose(R0, R1)
True
>>> angles = (4.0*math.pi) * (numpy.random.random(3) - 0.5)
>>> for axes in _AXES2TUPLE.keys():
...    R0 = euler_matrix(axes=axes, *angles)
...    R1 = euler_matrix(axes=axes, *euler_from_matrix(R0, axes))
...    if not numpy.allclose(R0, R1): print axes, "failed"
hrpsys_config.euler_matrix(ai, aj, ak, axes='sxyz')

Return homogeneous rotation matrix from Euler angles and axis sequence.

ai, aj, ak : Euler’s roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple

>>> R = euler_matrix(1, 2, 3, 'syxz')
>>> numpy.allclose(numpy.sum(R[0]), -1.34786452)
True
>>> R = euler_matrix(1, 2, 3, (0, 1, 0, 1))
>>> numpy.allclose(numpy.sum(R[0]), -0.383436184)
True
>>> ai, aj, ak = (4.0*math.pi) * (numpy.random.random(3) - 0.5)
>>> for axes in _AXES2TUPLE.keys():
...    R = euler_matrix(ai, aj, ak, axes)
>>> for axes in _TUPLE2AXES.keys():
...    R = euler_matrix(ai, aj, ak, axes)