-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battery and IR noise protection #2
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the contribution!
Could you change your commit description to include a bit more details about the change you are actually doing?
I.e. you are reading voltage periodically and changing state accordingly? etc.
|
||
Version 2 of the [kilolib library](https://github.com/acornejo/kilolib) has been modified to add IR noise filtering and battery protection. All details can be found on the [kilobots wiki](https://diode.group.shef.ac.uk/kilobots/index.php/Kilobots). | ||
|
||
For information about the original library, please refer to [https://www.kilobotics.com](https://www.kilobotics.com). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this section so we can merge this PR.
@@ -429,13 +617,16 @@ int16_t get_voltage() { | |||
adc_start_conversion(); | |||
adc_finish_conversion(); | |||
voltage = ADCW; // store AD result | |||
// adc_trigger_high_gain(); // set AD to measure high gain (for distance sensing) | |||
|
|||
//adc_trigger_high_gain(); // set AD to measure high gain (for distance sensing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the whitespace change?
@@ -505,6 +696,10 @@ ISR(TIMER0_COMPA_vect) { | |||
OCR0A = tx_increment; | |||
kilo_ticks++; | |||
|
|||
// Increments counter_ticks_for_voltage by 1 tick until 255 | |||
if(kilo_state == RUNNING && counter_ticks_for_voltage < 255) | |||
counter_ticks_for_voltage++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a strange place to be fiddling with voltage. users are not guaranteed to call estimate_Distance, so relying on it will be flaky.
set_color(RGB(3,3,3)); | ||
_delay_ms(10); | ||
if (rx_busy) { | ||
if(is_in_low_voltage == N_REPETITIONS_LOW_VOLTAGE){ // Low battery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is pretty intrusive to this function. I think we would want to refactor this into several functions that are called from this to keep the main loop somewhat readable.
Hi, at the Bristol Robotics Laboratory we have realised that some Kilobots go to SLEEPING or IDLE mode when running, and that hat Firmware 2.0 doesn't have any battery protection. I have implemented some changes to the firmware to filter out noise and to send the Kilobots to sleep when they detect low battery. So far, all tests have been successful. However, more tests from other teams would be very valuable.
More details are given here: https://diode.group.shef.ac.uk/kilobots/index.php/Kilobot_Firmware