- Forum
- Roboteq Motor Controllers
- MicroBasic
- Help with script for testing and setting RC Pulse Failsafe values
Help with script for testing and setting RC Pulse Failsafe values
3 years 8 months ago - 3 years 8 months ago #29534897
by wstuck
I am not a programmer and need some basic help with a script that will check in real time the values that are being received by an RC controller input for RC 1 and RC 2 values and test them against a known min and max value. Then determine if the real input value from the RC controller can be used or if a scripted safe value should be used. I am using an SDC2130 controller but I think the scripting should work on most controllers.
This is a first draft but it is not complete because i am not sure how to write the script correctly. Thanks in advance for any help or suggestions.
' Script reads RC_1 and RC_2 for values
' If values are out of range it sets new values to a known "safe" condition
RC_1_min = ?? 'Under limit of RC_1 signal value
RC_1_max = ?? 'Over limit of RC_1 signal value
RC_1_safe = ?? 'Safe known value for RC_1 signal value
RC_2_min = ?? 'Under limit of RC_2 signal value
RC_2_max = ?? 'Over limit of RC_2 signal valve
RC_2_safe = ?? 'Safe known value for RC_2 signal value
' Safe condition values are input by script when RC_1 or RC_2 are out of limits
' If RC_1 and RC_2 values are within the min and max values use real RC controller values
top:
pulse_1 = getvalue(_pic,1) 'put pulse RC_1 in variable
pulse_2 = getvalue(_pic,2) 'put pulse RC_2 in variable
' Test min and max conditions for RC_1 and RC_2
if pulse_1 => RC_1_max or pulse_1 =< RC_1_min then
setcommand(_go,1, RC_1_safe)
if pulse_2 => RC_2_max or pulse_2 =< RC_2_min then
setcommand(_go,2, RC_2_safe)
else
' Use the standard RC_1 and RC_2 inputs from real RC controller
' Possible time delay if needed
goto top 'loop back and test new RC_1 and RC_2 values
This is a first draft but it is not complete because i am not sure how to write the script correctly. Thanks in advance for any help or suggestions.
' Script reads RC_1 and RC_2 for values
' If values are out of range it sets new values to a known "safe" condition
RC_1_min = ?? 'Under limit of RC_1 signal value
RC_1_max = ?? 'Over limit of RC_1 signal value
RC_1_safe = ?? 'Safe known value for RC_1 signal value
RC_2_min = ?? 'Under limit of RC_2 signal value
RC_2_max = ?? 'Over limit of RC_2 signal valve
RC_2_safe = ?? 'Safe known value for RC_2 signal value
' Safe condition values are input by script when RC_1 or RC_2 are out of limits
' If RC_1 and RC_2 values are within the min and max values use real RC controller values
top:
pulse_1 = getvalue(_pic,1) 'put pulse RC_1 in variable
pulse_2 = getvalue(_pic,2) 'put pulse RC_2 in variable
' Test min and max conditions for RC_1 and RC_2
if pulse_1 => RC_1_max or pulse_1 =< RC_1_min then
setcommand(_go,1, RC_1_safe)
if pulse_2 => RC_2_max or pulse_2 =< RC_2_min then
setcommand(_go,2, RC_2_safe)
else
' Use the standard RC_1 and RC_2 inputs from real RC controller
' Possible time delay if needed
goto top 'loop back and test new RC_1 and RC_2 values
Please Log in or Create an account to join the conversation.
- Forum
- Roboteq Motor Controllers
- MicroBasic
- Help with script for testing and setting RC Pulse Failsafe values
Time to create page: 0.050 seconds