Every time I run this code I get an exception ‘ABB.Robotics.ModeRejectExecption’.
Friend Function WriteAnalogOutput( sigName as String, sigValue as Double ) as Boolean
Dim aSignal as Signal
Dim signalValue as AnalogSignal
Dim returnValue as Boolean
Try
If _robotController.Connected And _robotController.OperatingMode = ControllerOperatingMode.Auto Then
returnValue = True
aSignal = _robotController.IOSystem.GetSignal( sigName )
signalValue = DirectCast( aSignal, AnalogSignal )
signalValue.Value = sigValue
Else
returnValue = False
End If
Catch ex as Exception
returnValue = False
Finally
If signalValue IsNot Nothing Then
signalValue.Dispose()
End If
End Try
WriteAnalogOutput = returnValue
End Function
Why does this happen?