Knightrider::kitty
About the project
Autonomous car which can fast race alone on white track and can omit obstacles. Also it can react to some special patterns noticed on the ground.
Project info
Difficulty: Difficult
Platforms: MATLAB, NXP, Texas Instruments
Estimated time: 7 months+
License: GNU General Public License, version 3 or later (GPL3+)
Items used in this project
Hardware components
View all
Software apps and online services
View all
Hand tools and fabrication machines
Story
- All repository we have is here:
https://github.com/witek117/NXPCup_2020
It contains firmware, software and hardware directories.
1. Hardware
All hardware contains 3D printed models and two PCB.
We used the chassis from Alamak
https://pl.aliexpress.com/item/32817153828.html?spm=2114.12010612.0.0.45fa4693xcQzfH
but we changed motors and all steering system.
a) steering
b) battery holder
c) back with extra hole for second camera stick (second camera is not used now)
d) back panel
e) PIXY CAM holder with lens holder
f) encoder disc (for feedback how hast the car is moving)
g) main board with:
- MKV58F1M0VLQ24
- MKL25Z128VLK4
- double H bridge driver
- double wireless connectivity via Bluetooth (we can plug BT adapters directly to connectors and debug both processors)
- seven-segment display
- buttons
- connectors for ultrasonic and laser sensors, encoders, servo, two line cameras (not used now) and PIXY CAM
h) laser sensors extension board with:
- connectors for six laser sensors
- PIXY CAM 2 connector (compatible with J2 connector on PIXY PCB board)
- connector for external LEDs
And all electric circuit is shown here:
2. Firmware, what we did so far
All source code is on github
https://github.com/witek117/NXPCup_2020/tree/master/firmware/car
CMake project
CMake is used to control the software compilation process for three targets:
- MKV58 - main microcontroller
- MKL25Z - microcontroller responsible for obstacle detection
- x86 - GoogleTest library for testing algorithms
So we do not need IDE for compiling this project, in the simplest case, all is needed is a command terminal console. But we used MCUXpresso for creating basic peripheral source code e.g. timers, ADC, PWM.
Structure of project in lcp branch:
C++20
Just for fan and learn something new.
PID – let’s get what we really want to
Commonly known problem is that some mechanical parts often don’t act exactly like they should and so the motors do. We put some voltage on them counting on achieving some result, but motors final value differs from our expectation due to friction and strengths distribution during the motion. That’s why we have implemented PID regulator algorithm to reduce occurring error and always get the proper value of motors. Such algorithm uses output signal from optical encoders to get real value of motors, compares it with demanded one and performs some changes of controlling signal to bring real value as close as it possible to the assumed one.
PIXY CAM 2
In µVision IDE we redesigned some source code. Camera can detect black and white lines and communicate with main board. We got rid of given code for line detecting. We wrote our new, because it caused us less problems with calibration.
3. Software
a) LPC PDF PARSER (lpc branch)
https://github.com/witek117/NXPCup_2020/tree/lpc/software/LPC_PDF_PARSER
For PIXY, LPCOpen was not enough, we needed some CMSIS-like registers description. It took long time to write it on our way, so we created pdf-table parser using C# and .NET with Visual Studio.
Table like this:
just copy and click "PARSE" in LPC_PDF_PARSER and we have code like this:
b) MATLAB app for simple car control
https://github.com/witek117/NXPCup_2020/tree/lpc/software/matlab
4. Make Pixy great again
We also decided to rewrite PixyCam source code. In this project we only need to stream video via USB and detect edges to decide where the track is. Also we do not like using µVision IDE. For us better is CMake with C++20. We bought a LPC4330-Xplorer Board with the same microcontroller that is in Pixy.
Source code is on github in lpc branch and LCP directory (target):
https://github.com/witek117/NXPCup_2020/tree/lpc/firmware/car
We use LPCOpen library and old Pixy code. By now all pins are set, both cores (M4 and M0) are working and USB is properly working with PC.
5. First loops with new firmware
6. Plans
- fully implement obstacle detection
- design and print models for six VL53L0X
- rewrite the rest of Pixy source code
- finish and trim all algorithms
- design new main board with better H Bridges, build in VL53L0X connectors and Pixy connector
Leave your feedback...