Sign detection is being performed using a camera and a RecognitionCards object. The RecognitionCards object is set up with a threshold value and is enabled to draw a box around the detected object. The robot uses sensors, cameras, and machine learning algorithms to detect and understand the sign, and then performs a corresponding action based on the signal detected.
These robots are often used in manufacturing, healthcare, and customer service industries to assist with tasks that require human-like interaction and decision-making.
sprite = Sprite('Tobi') quarky = Quarky() import time quad=Quadruped(4,1,8,5,3,2,7,6) recocards = RecognitionCards() recocards.video("on flipped") recocards.enablebox() recocards.setthreshold(0.6) quad.home() while True: recocards.analysecamera() sign = recocards.classname() sprite.say(sign + ' detected') if recocards.count() > 0: if 'Go' in sign: quarky.drawpattern("jjjijjjjjiiijjjiiiiijjjjijjjjjjijjj") quad.move("forward",1000,1) if 'Turn Left' in sign: quarky.drawpattern("jjjddjjjjjdddjdddddddjjjdddjjjjddjj") quad.move("lateral right",1000,1) if 'Turn Right' in sign: quarky.drawpattern("jjggjjjjgggjjjgggggggjgggjjjjjggjjj") quad.move("lateral left",1000,1) if 'U Turn' in sign: quarky.drawpattern("jjjbjjjjjjbjjjjbbbbbjjjbbbjjjjjbjjj") quad.move("backward",1000,1) else: quad.home()
- This code is using several objects to detect and respond to certain signs or images captured by a camera.
- First, it creates a Sprite object with the name ‘Tobi’, and a Quarky object. It also imports a time module.
- Next, a Quadruped object is created with some parameters. Then, a RecognitionCards object is created to analyze the camera input. The object is set to enable a box around the detected object and to set the threshold of detection to 0.6.
- The code then puts the Quadruped object in its home position and enters an infinite loop.
- Within the loop, the code captures the camera input and uses the RecognitionCards object to analyze it. If an object is detected, the object’s class name is retrieved and used by the Sprite object to say that the object was detected.
- If the count of detected objects is greater than zero, the code checks if the detected object is a specific sign.
- If the object is a ‘Go‘ sign, the Quarky object will draw a specific pattern, and the Quadruped object will move forward.
- If the object is a ‘Turn Left‘ sign, the Quarky object will draw a different pattern and the Quadruped object will move to the right.
- If the object is a ‘Turn Right‘ sign, the Quarky object will draw another pattern, and the Quadruped object will move to the left.
- Finally, if the object is a ‘U Turn‘ sign, the Quarky object will draw a fourth pattern, and the Quadruped object will move backward.
- If the detected object is not any of the specific signs, the Quadruped object will return to its home position.
- So, this code helps a robot understand hand signs and move in response to them!