Table of Contents

Function Definition: enablebox()

Parameters

Description

The function enables the automatic display of the box on object detection on the stage.

Example

The example demonstrates how to detect persons on the stage with different confidence thresholds.

Code

sprite = Sprite('Tobi')
obj = ObjectDetection()

obj.enablebox()
sprite.gotoxy(-180, -110)
sprite.setsize(100)

obj.setthreshold(0.3)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.3 Threshold", 2)

obj.setthreshold(0.5)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.5 Threshold", 2)

obj.setthreshold(0.9)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.9 Threshold", 2)

Output

Read More
waste
A waste management system that will differentiate the waste based on its type in Python Coding Environment. If it detects biodegradable waste, the LEDs Quarky’s matrix will turn green. If it’s non-biodegradable waste, the LEDs will turn blue.

Code

sprite = Sprite('Tobi')
od = ObjectDetection()
speech = TexttoSpeech()
quarky = Quarky()

od.video("on", 1)
od.enablebox()
od.setthreshold(0.5)

speech.setvoice('alto')
speech.setlanguage('en')

while True:
  od.analysecamera()
  
  if od.isdetected('banana'):
    quarky.drawpattern("ccccccccccccccccccccccccccccccccccc")
    speech.speak("Biodegradable Waste")
  
  if od.isdetected('bottle'):
    quarky.drawpattern("fffffffffffffffffffffffffffffffffff")
    speech.speak("Non Biodegradable Waste")

Output

waste

Read More
Learn how to code logic for video input detection with this example code. You will be able to direct your own Mecanum easily by just showing signs through the camera input.

Introduction

A sign detector Mecanum robot is a robot that can recognize and interpret certain signs or signals, such as hand gestures or verbal commands, given by a human. 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.

Code

sprite = Sprite('Tobi')
quarky = Quarky()
import time
meca=Mecanum(1,2,7,8)
recocards = RecognitionCards()

recocards.video("on flipped")
recocards.enablebox()
recocards.setthreshold(0.6)

while True:
  recocards.analysecamera()
  sign = recocards.classname()
  sprite.say(sign + ' detected')
  if recocards.count() > 1:
    if 'Go' in sign:
      meca.runtimedrobot("forward",100,2)
    if 'Turn Left' in sign:
      meca.runtimedrobot("lateral left",100,2)
    if 'Turn Right' in sign:
      meca.runtimedrobot("lateral right",100,2)
    if 'U Turn' in sign:
      meca.runtimedrobot("backward",100,2)

Logic

  1. Firstly, the code sets up the stage camera to look for signs and detects and recognizes the signs showed on the camera.
  2. Next, the code starts a loop where the stage camera continuously checks for the signs.
  3. Finally, if the robot sees certain signs (like ‘Go’, ‘Turn Left’, ‘Turn Right’, or ‘U Turn’), it moves in a certain direction (forward, backward, left, or backward) based on the respective signs.
  4. This can help the Mecanum to manoeuvre through the terrain easily by just showing signs on the camera.

Final Output

Forward Motion:

Right-Left Motions:

Read More
All articles loaded
No more articles to load