Pop.Pilot

Pop.Pilot is an easy and fast training library for robot control.
This library can control the front wheels of two and four wheel drive vehicles with steering control.
This library is used in AIoT AutoCAR Series, AIoT SerBot Series.



Class Driving

Initialization

Driving() : Driving object. and speed set 20.
  In AIoT AutoCar Prime X, AIoT AutoCAR 2, AIoT AutoCAR 3, AIoT SerBot Prime X, pop.CAN.Car() object also initialize when initialize.

Methods

setSpeed(speed) : set speed.
  Params
   speed : Specify a value between 20 and 99.

getSpeed() : return current speed.

stop() : stop driving. wheel set 0.

direction(stat, speed) : set speed and direction.
  Params
   stat : driving direction. Driving.STAT_BACKWARD or Driving.STAT_FORWARD.
   speed : Specify a value between 20 and 99.

Example

simple example
from pop.Pilot import Driving
import time 

drv = Driving()
drv.direction(drv.STAT_FORWARD, 50)
time.sleep(5)
drv.setSpeed(30)
time.sleep(5)
drv.stop()



Class AutoCar

Class for easy control of AIoT AutoCar Series.

The code to import the Autocar Class :

from pop.Pilot import Autocar

Initialization

AutoCar() : AutoCar object.
  when AIoT AutoCAR Prime X initialize, pop.CAN.Car() object also initialize.
  when AIoT AutoCAR 2 and AIoT AutoCAR 3 initialize, pop.CAN.Car() object also initialize and set ultrasonic & axis9 sensors.

Methods

steering(value) : set wheel angle
  Params
   value : set wheel as value. range -1~+1. 0 is center. -1 is left. +1 is right.

turnLeft() : set wheel turn left

turnRight() : set wheel turn right

turnCenter() : set wheel turn center

setSpeed(speed) : set speed
  Params
   speed : Specify a value between 20 and 99

getSpeed() : return current speed

stop() : stop driving

forward(speed=None) : set dc motor direction to forward and set speed
  Params
   speed : Specify a value between 20 and 99. if do not set speed value, only set dc motor direction

backward(speed=None) : set dc motor direction to backward and set speed
  Params
   speed : Specify a value between 20 and 99. if do not set speed value, only set dc motor direction

camPan(value) : set pan angle
  This method is used in AIoT AutoCAR, AIoT AutoCAR Prime, AIoT AutoCAR Prime X, AIoT AutoCAR 2.
  Params
   value : Pan angle

camTilt(value) : set tilt angle
  This method is used in AIoT AutoCAR, AIoT AutoCAR Prime, AIoT AutoCAR Prime X, AIoT AutoCAR 2.
  Params
   value : Tilt angle

joystick() : display joystick

alarm(scale, pitch, duration=0) : control buzzer
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   scale : set scale
   pitch : set pitch
   duration : set duration

setSensorStatus(ultrasonic=1, axis9=1, euler=0, gravity=0, battery=0, cds=0) : set sensor data receive
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   ultrasonic : set ultrasonic sensor on(1)/off(0)
   axis9 : set axis9 sensor on(1)/off(0)
   euler : set euler sensor on(1)/off(0)
   gravity : set gravity sensor on(1)/off(0)
   battery : set battery value on(1)/off(0)
   cds : set cds sensor on(1)/off(0)

setObstacleDistance(distance=20) : set obstacle distance
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   distance : set obstacle distance. 20 < range <= 180. if distance set below 20, obstacle distance function disable.

setLamp(front=0, rear=0) : set lamp on/off
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   front : front lamp on(1)/off(0)
   rear : rear lamp on(1)/off(0)

setPixelDisplay(num, red, green=0, blue=0) : set PixelDisplay
  This method is used in AIoT AutoCAR 2.
  Params
   num : pixel display number. 0~255
   red : red value. 0~255
   green : green value. 0~255
   blue : blue value. 0~255

getUltrasonic() : Return ultrasonic value as list. [front0, front1, rear1, rear2]
  This method is used in AIoT AutoCAR Prime X, AIoT AutoCAR 2, AIoT AutoCAR 3.

getAxis9() : Return the accel, Magnetic, Gyro value as list. [accel_data x y z, magnetic_data x y z, gyro_data x y z]
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.

getAccel(axis=None) : Return the accel value
  Params
   axis : Enter 'x' or 'y' or 'z' to return the accel value of the axis. Return all if there is no input.

getMagnetic(axis=None) : Return the magnetic value
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   axis : Enter 'x' or 'y' or 'z' to return the magnetic value of the axis. Return all if there is no input.

getGyro(axis=None) : Return the gyro value
  Params
   axis : Enter 'x' or 'y' or 'z' to return the gyro value of the axis. Return all if there is no input.

getEuler(axis=None) : Return the euler value
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   axis : Enter 'x' or 'y' or 'z' to return the euler value of the axis. Return all if there is no input.

getGravity(axis=None) : Return the gravity value
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.
  Params
   axis : Enter 'x' or 'y' or 'z' to return the gravity value of the axis. Return all if there is no input.

getLight() : Return the CDS value
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.

getBattery() : Return the Battery voltage value
  This method is used in AIoT AutoCAR 2, AIoT AutoCAR 3.



Class SerBot

Class for easy control of AIoT SerBot Series.

The code to import the SerBot Class :

from pop.Pilot import SerBot

Initialization

SerBot(bus=1) : SerBot Object
  Params
   bus : I2c bus number to control SerBot's motors and sensors.

Variables

steering : Steer the front wheel of the SerBot left or right. Specify a value between -1 and 1.

Methods

move(degree, speed) : SerBot moves in the direction specified by degree.
  Params
   degree : Specify the direction of movement.
   speed : Specify a value between 0 and 99.

setSpeed(speed) : Control SerBot speed.
  Params
   speed : Specify a value between 0 and 99.

stop() : Stop SerBot.

forward() : Let the SerBot move forward.

backward() : Let the SerBot move backward.

joystick() : The SerBot is controlled using a virtual joystick.

getAccel(axis=None) : Return the accel value through the sensor mounted on the SerBot.
  Params
   axis : Enter 'x' or 'y' or 'z' to return the accel value of the axis. Return all if there is no input.

getGyro(axis=None) : Return the gyro value through the sensor mounted on the SerBot.
  Params
   axis : Enter 'x' or 'y' or 'z' to return the gyro value of the axis. Return all if there is no input.



Class joystick

Initialization

joystick() : joystick object

Methods

show() : display joystick



Class Data_Collector

Image data collection class for machine learning.

The code to import the Data_Collector Class :

from pop.Pilot import Data_Collector

 Initialization

Data_Collector(separator, camera=None, auto_ready=True, save_per_sec=5) : Data_Collector Object
  Params
   separator : Enter the purpose of data collection. 'Collision_Avoid' or 'Track_Follow'. In AIoT AutoCAR 3, 'Track_Follow_Turn' or 'Object_Follow' can be available.
   camera : Camera class to utilize camera images.
   auto_ready : Set whether to automatically configure a GUI screen to assist data collection.
   save_per_sec : Amount of data stored per second.

 Methods

show() : GUI display for data collection.

ready() : Construct a GUI screen to assist data collection. It is configured according to Collision Avoid or Track Follow..

save_as_joystick(value) : Save the image using the joystick. Only use for Track Follow.
  Params
   value : This is a list containing 'sep', 'x', 'y'.

control_as_joystick(value) : Use the joystick to control the robot. Only use for Collision Avoid.
  Params
   value : This is a list containing 'sep', 'x', 'y'.

save_blocked() : Save the block image file in the specified path. Only use for Collision Avoid. default save path "./collision_dataset/blocked".

save_free() : Save the free image file in the specified path. Only use for Collision Avoid. default save path "./collision_dataset/free".

save_snapshot(directory) : Save the image file in the specified path. Only use for Collision Avoid.
  Params
   directory : Path to save image file.