Quarky Advance Line Following

QRK Line Following
Extension Description

Introduction

The extension helps you to speed up your quarky in the line following using blocks and Python functions.

Read More

PictoBlox Blocks

Configure Quarky for advanced line following by connecting two IR sensors to analog pins or three IR sensors to digital pins for optimal alignment and control.
This block makes the robot move forward and reverse for a set time, collecting IR sensor data on both white and black lines.
This block moves the robot forward and backward for a set time, collecting IR sensor data on both white and black lines.
This block allows you to adjust the robot’s turning speed.
Select left and right IR sensors for line following using either onboard or external sensors connected to analog pins.
Set the IR threshold for onboard or external sensors connected to Quarky’s analog pin.
Set the pins for the left, middle, and right IR sensors to enable line following. Note: For 3 IR Sensors, the threshold is set by the potentiometers on the sensors as they work with digital value.
This block sets motor speeds for Quarky’s line following, defining forward and turning speeds for tracking a black line on a white path.
This block helps robot to follows a line and stops at checkpoints, detecting these when both IR sensors sense black simultaneously.
PID functions use sensor feedback to improve the robot’s movement accuracy and stability.
This block is use for set the motor speed while doing the line following and Turning.
The robot uses a PID algorithm for line following, stopping at a crossing line when the IR threshold is met; set PID speed, constants, and adjust parameters for optimal performance.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load

Python Functions

This function ensures proper sensor alignment for precise line-following control.
Syntax: AdvanceLineFollowing(ir_num = 2)
This function moves the robot forward and reverse for a set time, collecting IR sensor data on white and black lines.
Syntax: calibrateir()
This function allows the robot to turn left or right to follow the next black line by setting the IR threshold and adjusting turn speed.
Syntax: turnrobotusingir(turn_direction = ‘left’, next_line = ‘next’)
This function sets the motor speed for the robot’s turns.
Syntax: setturingspeed(turn_speed = 50)
Select the left and right IR sensors for line following, choosing between onboard Quarky IR sensors or external sensors connected to analog pins.
Syntax: setlinefollowerparameter(set_sensor = ‘left’, set_pin = ‘A1’)
This function sets the IR threshold for either the default sensor or one connected to an analog pin.
Syntax: setirthreshold(set_sensor = ‘left’, set_value = 750)
This function sets the three pins for IR sensors used in line following for left, middle, and right detection.
Syntax: setirsensor(set_left = ‘D1’, set_middle = ‘D2’, set_right = ‘D3’)
This function’s parameters match the Quarky board’s regular line following settings, defining motor speeds: F for forward on white, and T1 and T2 for gentle turning along the black line.
Syntax: setlinefollowerparameter(F = 35, T1 = 40, T2 = 10)
This function enables the robot to follow a line continuously until it detects a checkpoint (both IR sensors on black); it stops only at the checkpoint or with a reset.
Syntax: dolinefollowinguntilcheckpointdetect(next_checkpoint = 1)
PID control of line follower is a method consisting of proportional, integral, and derivative functions to improve the robot’s movement. 
Syntax: setPIDconstantparameter(kp = 0.8, ki = 0.01, kd = 0.2)
This function is used for set the Base Speed, Min Speed and Max Speed of motors for line following and turn.
Syntax: setPIDspeedparameter(base = 40, min = 0, max = 80)
This function starts line following with the PID algorithm, stopping at a checkpoint based on the IR threshold; set PID speed, constants, and adjust parameters for best performance.
Syntax: dolinefollowingwithPID(next_checkpoint = 1)
All articles loaded
No more articles to load
Table of Contents