Quarky Advance Line Following
Extension Description
- Available in: Block Coding, Python Coding
- Mode: Stage Mode, Upload Mode
- WiFi Required: No
- Compatible Hardware in Block Coding: Quarky
- Compatible Hardware in Python: Quarky
- Object Declaration in Python: linefollow = quarkyAdvanceLineFollowing();
- Extension Catergory: Quarky
Introduction
The extension helps you to speed up your quarky in the line following using blocks and Python functions.
Read More
PictoBlox Blocks
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