Robot (Quarky)

Robot-(Quarky)
Extension Description
Controls robot movement and line-following, motor, and servo operations.

Introduction

The robot extension allows controlling the actuators of Quarky – Motor and Servo Motor. The extension provides a simplified version of the line following making life easy for the users.

Connecting Quarky with PictoBlox

Let’s begin by first connecting Quarky to PictoBlox. Select your preferred type of device i.e. either the desktop/laptop or your smartphone and follow the instructions.

Desktop

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, connect Quarky to your laptop using a USB cable.
    Power Quarky
  2. Next, open PictoBlox on your desktop.
  3. After that, select Block or Python Coding as your coding environment.
  4. Then, click the Board button in the toolbar and select board as Quarky.
  5. Next, select the appropriate Serial port if the Quarky is connected via USB or the Bluetooth Port if you want to connect Quarky via Bluetooth and press Connect.
    COM Port

And voila! Quarky is now connected to PictoBlox.

Mobile

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, power ON Quarky.
  2. Open PictoBlox on your smartphone. Go to My Space and make a new project by clicking the ‘+(plus)’ button in the bottom-right corner.
    PictoBlox in Mobile Phone
  3. Then, tap the Board button in the top-right corner of the toolbar.
    PictoBlox BoardSelect board as Quarky.
  4. Next, tap the Connect button:
    PictoBlox ConnectSelect your device from the list.

And voila! Quarky is now connected to PictoBlox.

Stage Mode

Stage mode is one of the two modes you can write your programs in Pictoblox. In this mode, you can write scripts for the sprite and boards to interact with sprites in real-time. If you disconnect the board with Pictoblox, you cannot interact with the board anymore. In this mode, you can make games and animation interacting with Quarky.

You can toggle between the upload mode and stage mode using the button on the top right side of Pictoblox.

Note:  You have to upload the firmware into the device before interacting with it. Please refer to this doc: https://ai.thestempedia.com/docs/updating-quarky-firmaware-with-pictoblox/

In Python Coding Environment, use the following object declaration to use Python functions in Stage Mode:

quarky = Quarky()

Upload Mode

Upload mode is one of the two modes you can write your programs in Pictoblox. This mode allows you to write scripts and upload them to the board so that you can use them even when it is not connected to your computer, for example, you need to upload a script for making moving robots.

In this case, Quarky will run offline according to the program and it can not interact with the stage.

In Python Coding Environment, use the following object declaration to use Python functions in Upload Mode:

from quarky import *
Read More

PictoBlox Blocks

The block moves the Quarky robot in the specified direction. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
The block moves the Quarky robot in the specified direction for the specified time. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
The block stops both the motors of the Quarky robot.
The block initializes the following line parameters for the Quarky robot – F. T1 and T2.
The block performs the automatic line following logic with the parameters specified in the set parameter F () T1 () T2 () block.
The block sets the orientation of the robot to align the left and right movement of the robot in horizontal robot position and vertical robot position.
The block sets the specified motor of the Quarky robot to the specified direction (“FORWARD” or “BACKWARD”) and specified speed.
The function stops the specified motor of the Quarky.
The block sets the servo motor connected to the specified servo pin to the specified angle.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load
The function moves the Quarky robot in the specified direction. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
Syntax: runrobot(direction = “FORWARD”, speed = 100)
The function moves the Quarky robot in the specified direction for the specified time. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
Syntax: runtimedrobot(direction = “FORWARD”, speed = 100, time = 1)
The function stops both the motors of the Quarky robot.
Syntax: stoprobot()
The function initializes the following line parameters for the Quarky robot – F. T1 and T2.
Syntax: initializelinefollower(F = 35, T1 = 40, T2 = 10)
The function performs the automatic line following logic with the parameters specified in the initializelinefollower() function.
Syntax: dolinefollowing()
The function sets the orientation of the robot to align the left and right movement of the robot in horizontal robot position and vertical robot position.
Syntax: setorientation(orientation = “HORIZONTAL”)
The function sets the specified motor of the Quarky robot to the specified direction (“FORWARD” or “BACKWARD”) and specified speed.
Syntax: runmotor(motor = “L”, direction = “FORWARD”, speed = 100)
The function stops the specified motor of the Quarky.
Syntax: stopmotor(motor = “L”)
The function sets the servo motor connected to the specified servo pin to the specified angle.
Syntax: moveservo(servo_pin = “Servo 1”, angle = 90)
All articles loaded
No more articles to load

Python Coding Examples

All articles loaded
No more articles to load
Table of Contents