Question

I've got an idea, but I wonder whether somebody else already has named it.

I'm writing code to control a machine with actuators, motors, etc., and software will be responsible for preventing collisions between some of its moving parts.

It's mostly useful to organize everything as a hierarchy, but collisions are possible between different sub-systems. The need for collision avoidance cuts across the hierarchy.

My idea is to create objects that I will call "hazard recognizers" for the present. Each hazard recognizer watches for one specific hazard by monitoring the machine's sensors and, is injected into the places were each motor and actuator that contributes to the hazard is controlled. The software that controls actuator X will consult a list of recognizers before each time it changes the state of the actuator.

Never mind how I will define the list of recognizers or, how I will ensure that each one is injected into every place where it is needed. My question is, has somebody already given this pattern a name?

Or, Has somebody already given this problem a name? I'd like to learn more about how other people have solved it, but I'm not sure what to search for.

Was it helpful?

Solution

The closest thing that comes to mind (from industrial automation software) is a watchdog. But watchdogs typically monitor whether the primary control task is still active or not. And if not, the watchdog just shuts down the hardware to prevent accidents. This is particularly meaningful in robotics. If the primary control task is lagging, the arm's position may be drifting too far from the desired position and the brakes should be put on to prevent damage.

But your idea is weird. First, those sensors are not going anywhere so there is nothing to follow for these hazard recognizers, making injection pointless. They should just have access to the sensors driver. Did you perhaps pick up some talk about dependency injection with the notion that it is a good thing?

What do you picture when you say "inject each into every place where it is needed"? If you inject something, you suggest that the receiver would have to actively call methods on the injected object as needed. This would defeat the purpose of any safety function. It is like having an airbag in your car with a button next to it that reads "press in case of crash".

Licensed under: CC-BY-SA with attribution
scroll top