sra-vjti / sra-board-component Goto Github PK
View Code? Open in Web Editor NEWESP-IDF component for SRA Board
Home Page: https://sravjti.in/sra-board-component/
License: MIT License
ESP-IDF component for SRA Board
Home Page: https://sravjti.in/sra-board-component/
License: MIT License
Add support for MPU6050 accelerometer using DMP to generate orientation, rather than using complementary filters.
Add support for ADC on ESP32 using multi sampling to get accurate results
Add map function to helper function header file, this has been used several times throughout the code.
sra-board-component/src/buttons.c
Line 8 in 9b6ac1d
Can inline comments be inserted for the GPIO config setup - what each of the struct element corresponds to and its purpose will be just fine.
#define MPU6050_SDA 22
#define MPU6050_SCL 21
and MPU6050's INT is connected to GPIO23 of esp32.
Kindly create macro for this
lvgl library seems more industry standard than u8g2 library. So we should rewrite all our OLED wrappers in lvgl library.
sra-board-component/src/buttons.c
Line 6 in 9b6ac1d
sra-board-component/include/servo.h
Line 27 in 6fc1236
As any other IMU, MPU6050 needs to be calibrated before use, this ensures that if there is any offset in the readings (which may be due to position of MPU6050) then it is accounted for.
An example of calibration : https://github.com/kerikun11/micromouse-kerise-v4/blob/master/firmware/src/hardware/imu.h#L125
The ADC one shot, ADC continuous drivers, and the ADC calibration driver have been redesigned. The old drivers have been marked as legacy. Therefore, the current version must be updated to use the new ADC drivers.
Currently sra-board-component has support for only 3 servos, but with new sra-board-hardware design which can support 4 servos, we need to add support for 4th servo as well.
The MCPWM driver has been redesigned, and the legacy driver has been depreciated.
The new MCPWM driver is object-oriented, where most of the MCPWM submodule has a driver object associated with it. The driver object is created by factory function. IO control function always needs an object handle, in the first place.
The component currently uses the legacy drivers, which needs to be updated.
Add support for motor drivers. Some points to consider while adding support
Must handle Parallel and normal mode through code, rather than menuconfig. This can be done with functions like enable_parallel_mode()
or passing parameters to enable_motor_driver(PARALLEL)
function.
Declare a static variable which is set to 0 if motor driver is disabled, set to 1 if motor driver is enabled in parallel mode, and set to 2 if it is initialise in normal mode.
There must be helper method like, read_motor_driver_mode()
, which will return the mode of the motor driver by reading the static variable defined above.
Functions should be abstract enough, don't define functions like bot_forward()
, etc. We don't know for what purpose the motor is going to be used, functions like set_motor_speed()
should be defined.
change pin definitions to accommodate the routing changes made for the motor driver, LSA and stepper driver, and also remove the redundant motor driver.
Line 48 in d58505f
@ombhilare999 The name of the function should be meaningful and explain its purpose.
@SAtacker Could we also a brief description of what this component does and what it comprises in the README itself?
Line 16 in d58505f
Can this if..else.. block be replaced by a switch statement with a default statement handling cases of channels other than LSA?
Line 50 in a11b18b
Code was referred from ESP32 ADC example:
https://github.com/espressif/esp-idf/blob/master/examples/peripherals/adc/main/adc1_example_main.c
They haven't done anything for calloc, @VedantParanjape @laukik-hase kindly check once.
Add support for Light Sensing Array. Use custom adc functions defined in adc.h which use multi sampling to get more accurate readings.
sra-board-component/src/servo.c
Line 9 in 6fc1236
Remove error handling blocks for functions which have a very little chance of failing. (These functions will be automatically get verified when stress-tested)
Change function name from init_line_sensor()
to enable_line_sensor()
Line 5 in 30ce480
It makes sense to automate the process of building docs using doxygen + github actions
As can be seen in first 10 secs of this video that the bot calibrates the LSA for efficiency in reading, this approach is better than directly hardcoding the values, as it accounts for different situations.
In the pdf which @ombhilare999 sent about the new design of SRA board, he mentioned that the mode of the motor drivers will be selected with the help of switches. So, what is the need of selecting the mode from the code?
@VedantParanjape @laukik-hase Was the idea of selecting the mode with switches scrapped?
sra-board-component/src/bar_graph.c
Line 15 in 68f9218
Mention the exact version of ESP-IDF that this component uses, which should be the one on which the entire testing phase was completed on.
Current implementation of this function is very large and a lot of code is repeated, It is a must to optimise this function
sra-board-component/src/motor_driver.c
Line 209 in 213ae2f
Checking the gh-pages branch, it doesn't seem like the docs are being pushed to it. Also, it doesn't seem updated on the website.
As of now the website is configured to pull docs from main branch :/docs folder.
sra-board-component/src/servo.c
Line 41 in 6fc1236
I think since we use the espressif v4.1 image, it overrides the git binary that ubuntu-latest provides. Please check if manually installing latest one with PPA fixes it
@VedantParanjape @luke2103 @OSSome01
Rather than having two different functions (with the same template) for the two drivers, can we have a single function which takes the motor driver to be initialised as parameter?
Line 8 in d58505f
@ombhilare999 Use a single error variable esp_err_t err
for all the purposes. This has already been discussed with @VedantParanjape
Add support for servos.
Create menuconfig entry to set min max pulse width
The build system of IDF v5.1 was updated to no longer use GCC based make system. More details are over here: https://docs.espressif.com/projects/esp-idf/en/v5.1.1/esp32/migration-guides/release-5.x/5.0/build-system.html
The current Wall-E build system must be updated to follow the guidelines laid down by espressif.
Add support for bar graph LED, keep in mind the following guidelines while coding:
since this shares pins with motor drivers, make sure to check if a motor driver is enabled, if it is that part of the bar graph shouldn't be operated.
While initializing bar-graph LED check the state of motor driver which shares pins with it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.