Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Danixk
Copy link

@Danixk Danixk commented Jun 20, 2019

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

Copy link
Owner

@acornejo acornejo left a 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).
Copy link
Owner

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)
Copy link
Owner

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++;
Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants