-
Notifications
You must be signed in to change notification settings - Fork 24
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
Read sensors in the systick #263
base: master
Are you sure you want to change the base?
Conversation
30c5d97
to
111f8b8
Compare
src/calibration.c
Outdated
|
||
disable_walls_control(); | ||
side_sensors_calibration(); |
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 are you using side_sensors_calibration?
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.
Removed in 58693b9. 👍
src/calibration.c
Outdated
sleep_us(1000); | ||
} | ||
required_deceleration = | ||
(.3 * .3) / |
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.
Macro for set_target_linear_speed and these .3* .3.
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.
Created a variable to store that value (58693b9).
src/target/detection.c
Outdated
} | ||
} | ||
|
||
/** | ||
* @brief Get sensors values with emitter on and off. | ||
* @brief Update the sensors raw readings. |
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.
Change the description to be different than on the function "update_raw_readings". Include the "Clear injected end of conversion" comment on the header of the function. Does not exist a function on libopencm3 to do that? (as for timer floag: timer_clear_flag(TIM1, TIM_SR_UIF))
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.
You can use adc_clear_flag from common.c file (pull request to libopencm3, it was already working for watchdog interruption flag)
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.
It seems the adc_clear_flag()
differs from what it is written here, right? Now we have:
ADC_SR(ADC1) &= ~ADC_SR_JEOC;
But calling adc_clear_flag()
would result in:
ADC_SR(ADC1) = ~ADC_SR_JEOC;
Note the &
is missing.
Is adc_clear_flag()
broken?
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.
Changed docstring as requested: 6faa22a
} | ||
|
||
/** | ||
* @brief Update the sensors raw readings. |
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.
Expand the description
@@ -290,7 +279,7 @@ void side_sensors_calibration(void) | |||
for (i = 0; i < SIDE_CALIBRATION_READINGS; i++) { | |||
left_temp += distance[SENSOR_SIDE_LEFT_ID]; | |||
right_temp += distance[SENSOR_SIDE_RIGHT_ID]; | |||
sleep_ticks(SENSORS_SM_TICKS); | |||
sleep_ticks(2); |
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 did you change it to 2? Coudl you add an explicative macro?
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.
How would you call it? It is just some small delay in between readings, it could be any other number really.
I could create a SIDE_CALIBRATION_READINGS_DELAY_TICKS
but looks huge just for one use and it really is not important. Does it hurt too much in your eyes? 😂
src/target/detection.c
Outdated
diff = 0; | ||
else | ||
diff = on - off; | ||
diff /= 4; |
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 4?
src/control.c
Outdated
@@ -9,14 +9,14 @@ | |||
*/ | |||
static volatile float linear_acceleration = 5.; |
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 these changes on this commit?
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.
Just for now, while the robot keeps crashing into walls like a drunken robot... I will remove it before merging into master. I hope...
src/calibration.c
Outdated
@@ -143,6 +143,7 @@ void run_movement_sequence(const char *sequence) | |||
*/ | |||
void run_front_sensors_calibration(void) |
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.
good :)
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.
😄
5fb877a
to
bf359f5
Compare
Moved to Portugal 2019 milestone. Added "on hold" label as this method results in less reliable readings. We probably need some hardware changes to improve that (i.e.: add capacitors next to the emitters to provide the required transient power). |
Fixes #216.