Рет қаралды 81
This is a test of a new "Roam" Behaviour on the KR01 robot, a discrete behaviour in a Behaviour-Based System. This uses a Subsumption Architecture implemented in Python, as part of the "kros-core" operating system.
The Roam Behaviour begins by waiting for three seconds and then setting the forward target velocity of the robot to SLOW. The robot moves forward slowly until it senses something at a configured maximum range of 50cm, then slows down to a stop at a minimum range of 25cm. Beyond the maximum range, Roam has no effect on the robot's behaviour.
It uses a center analog infrared sensor to detect obstacles. This sensor returns values in centimeters and publishes messages containing that value onto a message bus. The Roam Behaviour is a subscriber to the message bus, and when a message with a INFRARED_CNTR event type is received it indicates that an obstacle has been detected, and the distance to the obstacle.
However, if the distance is less than the maximum range it inserts a lambda function into the motor controller that returns a value as a function of distance, where 1.0 is returned at the maximum range, 0.0 is returned at the minimum range. This value is multiplied against the target velocity of the motor. So at maximum range this has no effect (the velocity is multiplied by 1.0), but gradually slows the robot down to zero at the minimum distance. If the obstacle is removed the robot waits 3 seconds and begins moving again.
If the obstacle is not removed the robot will just sit there, forever. Or until some other behaviour, like an obstacle-avoidance behaviour, is triggered.