Adding fault support for main board faults
Description
Adding fault support for main board faults by adding:
-
RegisterFaultCallback()
andSubscribeToFaults()
toRobotClient
- Adding the
Faults
andMainBoardFault
types toMsgTypes
. - Adding documentation on how to use to
SubscribeToFaults()
(see below) - Added
/info/faults
toBurtSharp.CoAP.Constants
Example usage:
// Set up communication with the robot and initialize force/torque to zero
RobotClient robot = new RobotClient ();
robot.SubscribeToServerUpdate (OnReceiveServerUpdate);
robot.SubscribeToRobotStatus (status => {
Barrett.Logger.Debug(Barrett.Logger.INFO, "Handedness: {0}", status.handedness);
Barrett.Logger.Debug(Barrett.Logger.INFO, "Outerlink: {0}", status.outerlink);
Barrett.Logger.Debug(Barrett.Logger.INFO, "IsPatientConnected?: {0}", status.patient);
});
// Register a fault callback on MainBoardFault.EStopPressed events. This calls
// the lambda function presented which prints a message to the terminal. These
// functions can be class methods too and delegats, not just lambdas. But must
// take arguments of a MainBoardFault, and a bool and return void.
robot.RegisterFaultCallback(MainBoardFault.EStopPressed, (code, is_set) => {
Barrett.Logger.Debug(Barrett.Logger.INFO, "{0} is set?: {1}\n", code, is_set);
});
robot.RegisterFaultCallback(MainBoardFault.EStopLatched, (code, is_set) => {
Barrett.Logger.Debug(Barrett.Logger.INFO, "{0} is set?: {1}\n", code, is_set);
});
robot.RegisterFaultCallback(MainBoardFault.NotInHomingPositionAtStartup, (code, is_set) => {
Barrett.Logger.Debug(Barrett.Logger.INFO, "{0} is set?: {1}\n", code, is_set);
});
robot.SubscribeToFaults ();
robot.SendCartesianForces(Vector3.zero);
What to focus on
Reviewers
Resources
Issues
What issues does this fix?
- Fixes #issue-number
Edited by Amy Blank