-
Notifications
You must be signed in to change notification settings - Fork 25
Read sensors in the systick #263
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
base: master
Are you sure you want to change the base?
Conversation
30c5d97 to
111f8b8
Compare
src/calibration.c
Outdated
| uint32_t ticks_to_stop; | ||
|
|
||
| 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
| 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
| * - Linear deceleration is defined in meters per second squared. | ||
| * - Angular acceleration is defined in radians per second squared. | ||
| */ | ||
| 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...
| * During this movement the robot will be logging information about the front | ||
| * sensors. | ||
| */ | ||
| 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.