2020-02-13, 09:34 PM
(This post was last modified: 2020-02-13, 09:35 PM by seandepagnier.)
(2020-02-13, 09:30 PM)McNugget Wrote: Regarding sanity checking: You are right. Most of the stuff get’s sanity checked. I should take that back.
In my version, and I don’t remember if your’s does that same, a steering command still starts to be executed even if min or max is already reached. It stops immediately, but some of the motion is done. In my case, that means the hydraulic pump as well as the hydraulic cylinder runs against a wall and get’s slightly stuck. I can drive put of that, though, but it means an improperly tuned controller runs into the wall all the time.. I want to change that to not allow any motion into an already maxed out direction.
Are you sure it does this?
You are using rudder feedback correct? In this case it must be calibrated and should stop before either rudder feedback or drive absolute rate is actually met so no stalling of the motor.
in process_packet()
Code:
if(value > 2000);
// unused range, invalid!!!
// ignored
else if(flags & (OVERTEMP_FAULT | OVERCURRENT_FAULT | BADVOLTAGE_FAULT));
// no command because of overtemp or overcurrent or badvoltage
else if((flags & (PORT_PIN_FAULT | MAX_RUDDER_FAULT)) && value > 1000)
stop();
// no forward command if port fault
else if((flags & (STARBOARD_PIN_FAULT | MIN_RUDDER_FAULT)) && value < 1000)
stop();
// no starboard command if port fault
else {
command_value = value;
engage();
}
If an incoming command arrives and there are end stops or rudder faults or other faults, it should not cause movement.