#include <KB2017Interface.h>
Inheritance diagram for OSCAR::KB2017Interface:

|
|
Constructor for KB2017Interface Use this to construct a KB2017Interface object. The constructor does the following: - Sets default limits on position gains and excess errors - Sets default joint command mode for all 17 joints to *POSITION MODE* - Sets data member motionTime to a default value of 5 Note: 1) The default values for excess error range and position loop gains have been determined from experience. These values are safe to use. Extra precaution must observed when altering these values 2) The motionTime should be set in the application by the user soon after instantiation of the class, if the user desires to overwrite the default value. Else, the motionTime written to the memory register would be the default value (=5). 3) Some mechanical problem with the 4th joint on the left arm (from the ROBOT's perspective) makes it jerk causing the robot to shut down. By giving it an excess error of 20 degrees, we can avoid erratic shutdowns, but at the cost of safety.
|
|
|
Destructor for KB2017Interface. This invokes the Close() method if it hasnt been called, This method was made virtual so that it could be potentially overridden.
|
|
|
Serves as a diagnostic tool to check the status of the servos This method accomplishes the following: - Primarily checks for joint position excess errors and gives notification as to which joint had the error Note: The data member noOfConsecutiveErrors is used to monitor the number of successive failure. There is a safety feature, which shuts the robot down if there have been maxConsecutiveErrors (JointPosition Excess Errors). maxConsecutiveErrors sets a tolerance on the max no of errors in series.
|
|
|
Closes the dual arm interface. This method accomplishes the following: - Stops the machine by calling MachineStop() - Deletes pointer to BIT3IO object which is used to to read (write) from (to) the Mr2Arm's memory registers. A call to this method is *MANDATORY* before ending the application can be called. The following pseudo-code illustrates the usage of this method:. int main(void) { OSCARError err = OSCARError(noError); KB2017Interface DualArm(err); Control16Bit motionTime = 4; //if this is ommitted, the motionTime is set to 5 (by default) if(!DualArm.SetMotionTime(motionTime)) return -1; //to overwrite the default value of 5 if(!DualArm.Initialize()) return -1; if(!DualArm.Home(false)) return -1; //refer to documentation for Home(bool autoHome) if(!DualArm.Close()) return -1; return 0; }
Reimplemented from OSCAR::Device. |
|
|
This function gets excess error values that are currently set for each joint. The returned excesserror vector is in radians.
|
|
|
|
|
|
This function gets positionLoopGain values that are currently set for each joint.
|
|
||||||||||||
|
This function is overridden here. A call to RobotServoInterface::GetServoValue() is made This function also deals with homing offsets, ie, if after homing, the left arm (from the robot's perspective) is low, an offset of 0.3306 radians (= 18.94 degrees) is added to its commanded position. This is an easy fix for that homing problem.
Reimplemented from OSCAR::RobotServoInterface. |
|
|
This function gets the current value of the status byte.
|
|
|
|
|
|
|
|
|
Should be used to home the dual arm. Note that the "home position" is not the "zero position" This method accomplishes the following: - Sets the jointExcessErrors and PositionLoopGains - Writes default values to MACHINE$START and CONTROL$BYTE registers To complete Initialize(), the user should press the ENABLE ARM button on the robot control panel and be prepared to press the EMERGENCY STOP button on the pendant (for safety reasons). After these have been complied with, the robot can be homed using Home() A call to this method is *MANDATORY* before any other method can be called. The following pseudo-code illustrates the usage of this method:. int main(void) { OSCARError err = OSCARError(noError); KB2017Interface DualArm(err); Control16Bit motionTime = 4; //if this is ommitted, the motionTime is set to 5 (by default) if(!DualArm.SetMotionTime(motionTime)) return -1; //to overwrite the default value of 5 if(!DualArm.Initialize()) return -1; //refer to documentation for Initalize() if(!DualArm.Home(false)) return -1; if(!DualArm.Close()) return -1; return 0; }
|
|
|
Initializes the dual arm interface This method accomplishes the following: - Creates pointer to BIT3IO object which is used to to read (write) from (to) the Mr2Arm's memory registers. This pointer is appropriately named mr2armio - Sets the jointExcessErrors and PositionLoopGains - Writes default values to MACHINE$START and CONTROL$BYTE registers To complete Initialize(), the user should press the ENABLE ARM button on the robot control panel and be prepared to press the EMERGENCY STOP button on the pendant (for safety reasons). After these have been complied with, the robot can be homed using Home() A call to this method is *MANDATORY* before any other method can be called. The following pseudo-code illustrates the usage of this method:. int main(void) { OSCARError err = OSCARError(noError); KB2017Interface DualArm(err); Control16Bit motionTime = 4; //if this is ommitted, the motionTime is set to 5 (by default) if(!DualArm.SetMotionTime(motionTime)) return -1; //to overwrite the default value of 5 if(!DualArm.Initialize()) return -1; if(!DualArm.Home(false)) return -1; //refer to documentation for Home(bool autoHome) if(!DualArm.Close()) return -1; return 0; }
Reimplemented from OSCAR::Device. |
|
|
This function retrieves the status of arm power. This is done by reading from MACHINE$START MACHINE$START holds '1' if arm power is ON.
|
|
|
This function turns the arm power off. This is done by writing '0' to MACHINE$START.
|
|
|
|
|
|
This function provides a method to move each joint of robot per step each time. The control memory registers for CW and CCW motion of each joint are defined in "KB2017ControlRegisters.h". All dual port commands to the servo processor except for absolute position commands are placed in this location.
|
|
|
This function sets current operation mode, and move the robot to the desired position set by SetDesiredPosition(...). The following are established by this method: - Runs a sanity check on input - Sets the value of each joint's command mode in the location JOINT$COM$MODE to 3 0 - Position Mode 1 - Velocity Mode 2 - Torque Mode 3 - Current Mode - Writes the value of param currentvalue to the register CURRENT$COMMAND - Sets the value '1' to COMMAND$FLAG to indicate that a new command has been placed in dual port memory.
|
|
|
This function writes the jointExcessError vector value into EXCESS$ERROR.
|
|
|
Checks sanity of user input and sets the data member jointExcessError value. In doing so, every joint's user defined excess error (in radians) should be multiplied by a contant countsPerRadian before writing to memory. This function should be called before any mode of operation, i.e. before SetServoValue(Position/Velocity/Torque, _value) or SetCurent(...). Excess error is a check on the numerical difference between two successive position commands. This ensures that the robot does not perform large movements in one position step. This method invokes the protected setExcessError method to write it to the appropriate memory location.
|
|
|
This function sets flag into INTERRUPT$MASK to disable/enable the Motion Controller interrupt to the Servo Processor, allowing/disallowing the host processor to intercept the command (PROVIDED it is wired for the bus intercept). During normal operation this variable is '0'(ENABLE).
|
|
|
This function sets a time division number in register COM$DIV$NUMBER. This number is used to set the interpolation time the K/B2017 uses to complete its move to the desired position.
|
|
|
Checks sanity of the input motiontime and sets the data member motionTime This method accomplishes the following: - Invokes the protected setMotionTime() method to write the motionTime to the appropriate memory register.
|
|
|
|
|
|
Checks sanity of user input and sets the data member positionLoopGains value. This function should be called before any mode of operation, i.e. before SetServoValue(Position/Velocity/Torque, _value) or SetCurent(...) and hence a call to it is made in the Initialize() method Invokes the protected setExcessError method to write it to the appropriate memory location.
|
|
||||||||||||
|
This function is overridden here. The functionality to check whether the machine power is on is added over here. Only if machine power is on, will this function be executed, otherwise it returns false. This prevents the sending of set points by the application when the robot arm power is turned off. This function also deals with homing offsets, ie, if after homing, the left arm (from the robot's perspective) is low, an offset of 0.3306 radians (= 18.94 degrees) is added to its commanded position. This is an easy fix for that homing problem.
Reimplemented from OSCAR::RobotServoInterface. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |