This is a source code for the Arduino-based robot with simple cooperative multitasking system and isolated modules which control different functions.
See the details in our blogs:
- http://onerobotstory.blogspot.com/ (English)
- http://refunpro.blogspot.com/ (Ukrainian)
- Arduino Mega 2560
- Motor Driver Shield V1
- ESP13 Shield
- Ultrasonic distance sensor HC-SR04 on a cradle
- TowerPro SG90 Mini Gear Micro Servo to turn the ultrasonic sensor left and right
- Infrared Obstacle Avoiding Sensors
- Tank chassis (Geekcreit T300 - can be any other)
- Rechargeable Battery 6xAA 2500 mAh
robot.ino - the entry point with the standard Arduino setup() and loop() functions
TaskInterface.h - defines the parent class for all "tasks" which are given a quant of time in the main multitasking loop
RobotAI.h/.cpp - the core class which orchestrates all the robot actions (including scenarios execution and remote control over Wi-Fi)
RobotDistanceSensor.h/.cpp - class for accessing the ultrasonic and infrared distance sensor
RobotConnector.h/.cpp - class for managing the remote connection through the serial interface
RobotLights.h/.cpp - class for controlling robot LED's
RobotMotors.h/.cpp - class for controling chasis motors
RobotVoice.h/.cpp - class for generating sounds
Remote control is performed over Wi-Fi connection using simple telnet-like connection. It is also compatible with RoboRemo: http://www.roboremo.com/
Command From RC | Action | Response from the Robot (on success) |
---|---|---|
MI | Mode-Idle | MI |
MA | Mode-AI | MA |
MS | Mode-Scenario | MS |
MR | Mode-Remote Control | MR |
W | Move Forward | - |
S | Move Backward | - |
A | Turn Left | - |
D | Turn Right | - |
LFx | Turn Front Lights (1 - ON, 2 - OFF) | LF1 or LF0 |
LRx | Turn Rear Lights (1 - ON, 2 - OFF) | LR1 or LR0 |
LSx | Turn Side Lights (1 - ON, 2 - OFF) | LS1 or LS0 |
R0 | Refresh Distances (with the head turn) | RLxx - left distance, where xx is a distance in centimeters with the leading zeros. RL-- means "not available" |
RFxx - front distance | ||
RRxx - right distance | ||
ROABCD - obstacle detectors state ("1"s or "0"s), A - left-ahead, B - left-edge, C - right-edge, D - right-ahead |
||
R1 | Refresh Distances (without the head turn) | same as above |
XAAABBB | Set the drives speed to AAA (left) and BBB (right). The speed is in range 000 - 511. 000 is full reverse, 511 means full ahead. | - |
- | Debug message from the robot | ~message text |
All commands should be followed by \n.
Added support for the front, rear, and side LED lights. More details here: http://refunpro.blogspot.com/??? (Ukr)
Added support for the advanced remote control based on the RoboRemoteFPV desktop RC dashboard project https://github.com/rmaryan/roboremote. More details here: https://onerobotstory.blogspot.com/2017/08/12-better-remote-control-with-fpv.html (Eng) or here http://refunpro.blogspot.com/2017/07/17.html (Ukr)
Added support for the Infrared Obstacle Detection Sensors. More details here: https://onerobotstory.blogspot.com/2017/08/11-infrared-distance-sensors.html (Eng) or here http://refunpro.blogspot.com/2017/03/16.html (Ukr)
Added support for the Ultrasonic Distance Sensor. More details here: http://onerobotstory.blogspot.com/2017/07/10-ultrasonic-distance-sensor.html (Eng) or here: http://refunpro.blogspot.com/2017/01/15.html (Ukr)
This is the initial version which includes simple scenario and the remote control code. More details here: http://onerobotstory.blogspot.com/2017/06/9-wifi-remote-control.html (Eng) or here: https://refunpro.blogspot.com/2016/11/10.html (Ukr)