/// <summary> /// Used to return state of solenoid. /// </summary> /// <remarks>Result based on set point.</remarks> /// <param name="solenoid">Solenoid to query</param> /// <returns>true if on, false if off</returns> public bool GetSolenoidActive(Solenoids solenoid) { UInt16 mask = this.GetSolenoidMask(solenoid); bool result = (0 != (this.robotSolenoidSetPoint & mask)) ? true : false; return (result); }
/// <summary> /// Used to set one solenoid at a time. /// </summary> /// <remarks> /// Configuring wheel solenoids to either both off or both on when action is move has the action set to off. /// Configuring wheel solenoids to axial when movement mode is circumferential has the mode set to normal axial. /// Configuring wheel solenoids to circumferential when movement mode is not circumferential has the mode set to circumfrential. /// </remarks> /// <param name="solenoid">solenoid to set</param> /// <param name="activate">true to turn on, false to turn off</param> public void SetSolenoid(Solenoids solenoid, bool activate) { UInt16 mask = this.GetSolenoidMask(solenoid); UInt16 adjustedSolenoidStatus = this.robotSolenoidSetPoint; if (false != activate) { adjustedSolenoidStatus |= mask; } else { adjustedSolenoidStatus &= (UInt16)~(mask); } this.UpdateSolenoidSetPoint(adjustedSolenoidStatus); }
public bool GetSolenoidActive(Solenoids solenoid) { return (RobotCommBus.Instance.GetSolenoidActive(solenoid)); }
private UInt16 GetSolenoidMask(Solenoids solenoid) { UInt16 result = 0; if (UlcRoboticsNicbotBody.Modes.repair == this.robotBody.Mode) { if (Solenoids.frontDrillCover == solenoid) { result = 0x0004; } else if (Solenoids.frontNozzleExtend == solenoid) { result = 0x4000; } else if (Solenoids.rearDrillCover == solenoid) { result = 0x0008; } else if (Solenoids.rearNozzleExtend == solenoid) { result = 0x8000; } else if (Solenoids.lowerArmRetract == solenoid) { result = 0x0002; } else if (Solenoids.lowerArmExtend == solenoid) { result = 0x0001; } else if (Solenoids.rearArmExtend == solenoid) { result = 0x0040; } else if (Solenoids.rearArmRetract == solenoid) { result = 0x0080; } else if (Solenoids.frontArmExtend == solenoid) { result = 0x2000; } else if (Solenoids.frontArmRetract == solenoid) { result = 0x1000; } } else if (UlcRoboticsNicbotBody.Modes.inspect == this.robotBody.Mode) { if (Solenoids.sensorRetract == solenoid) { result = 0x0001; } else if (Solenoids.sensorExtend == solenoid) { result = 0x0002; } else if (Solenoids.sensorArmStow == solenoid) { result = 0x0004; } else if (Solenoids.sensorArmDeploy == solenoid) { result = 0x0008; } else if (Solenoids.lowerArmRetract == solenoid) { result = 0x0010; } else if (Solenoids.lowerArmExtend == solenoid) { result = 0x0020; } else if (Solenoids.rearArmExtend == solenoid) { result = 0x1000; } else if (Solenoids.rearArmRetract == solenoid) { result = 0x2000; } else if (Solenoids.frontArmExtend == solenoid) { result = 0x4000; } else if (Solenoids.frontArmRetract == solenoid) { result = 0x8000; } } return (result); }
public void SetSolenoid(Solenoids solenoid, bool activate) { RobotCommBus.Instance.SetSolenoid(solenoid, activate); }