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

Spike autocharge #1336

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

YannLocatelli
Copy link
Member

No description provided.

@YannLocatelli YannLocatelli self-assigned this Dec 11, 2023
@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch 2 times, most recently from f7136e8 to 44d0e19 Compare December 11, 2023 15:39
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8748b73) 98.74% compared to head (c1cc2f0) 98.74%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1336   +/-   ##
========================================
  Coverage    98.74%   98.74%           
========================================
  Files          146      146           
  Lines         3759     3759           
========================================
  Hits          3712     3712           
  Misses          47       47           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YannLocatelli YannLocatelli added this to the Future Release milestone Dec 11, 2023
@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch 2 times, most recently from e5da452 to b23b856 Compare December 12, 2023 13:58
Copy link
Member Author

@YannLocatelli YannLocatelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set a timeout + use BLE commands to activate the autocharge + prepare to behaviorkit (uniform)

@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch from b23b856 to 17cb998 Compare December 12, 2023 17:25
Copy link

github-actions bot commented Dec 13, 2023

🔖 Version comparison

Version Same as filename Same as os_version
os 1.4.0+1706794662 ✔️ ✔️
firmware
(bootloader + os)
1.4.0+1706794662 ✔️ ✔️

Copy link

github-actions bot commented Dec 13, 2023

📈 Changes Impact Analysis Report

📌 Info

  • toolchain: GNU Arm Embedded Toolchain 10.3-2021.10 - 10.3.1 20210824
  • enable_log_debug: ON
base head
branch develop yann/feature/charge/use-imukit-and-motors-to-go-on-charge
sha 8748b73 c1cc2f0
mbed mbed-os@master+fixes+gcc-11-support mbed-os@master+fixes+gcc-11-support
-std -std=c++20 -std=c++20

🤖 Firmware impact analysis

Target Flash Used (base/head) Flash Used Δ Flash Available (base/head) Static RAM (base/head) Static RAM Δ
bootloader 183756 (70%) ø 78388 (29%)
78388 (29%)
41664 (7%) ø
os 502268 (32%) ø 1062404 (67%)
1062404 (67%)
94608 (18%) ø
Click to show memory sections
| -          |      Hex |     Bytes |  KiB |
|------------|---------:|----------:|-----:|
| Flash      | 0x200000 | 2 097 152 | 2048 |
| SRAM       |  0x80000 |   524 288 |  512 |
| Bootloader |  0x40000 |   262 144 |  256 |
| Header     |   0x1000 |     4 096 |    4 |
| OS         | 0x17E000 | 1 564 672 | 1528 |
| Tail       |   0x1000 |     4 096 |    4 |
| Scratch    |  0x40000 |   262 144 |  256 |

🔬 Detailed impact analysis

Click to show detailed analysis for all targets
  • ✔️ - existing target
  • ✨ - new target
  • ⚰️ - deleted target
  • ✅ - files are the same
  • ❌ - files are different
Target Status .bin .map Total Flash (base/head) Total Flash Δ Static RAM (base/head) Static RAM Δ
LekaOS ✔️ 502268 (23%) ø 94608 (18%) ø
bootloader ✔️ 183756 (8%) ø 41664 (7%) ø
functional_ut_boost_ut ✔️ 409276 (19%) ø 30608 (5%) ø
functional_ut_core_imu ✔️ 385140 (18%) ø 31120 (5%) ø
functional_ut_deep_sleep_core_buffered_serial ✔️ 368332 (17%) ø 30560 (5%) ø
functional_ut_deep_sleep_core_motor ✔️ 376204 (17%) ø 30632 (5%) ø
functional_ut_deep_sleep_core_pwm ✔️ 378420 (18%) ø 30632 (5%) ø
functional_ut_deep_sleep_log_kit ✔️ 365268 (17%) ø 30976 (5%) ø
functional_ut_deep_sleep_mbed_hal ✔️ 366712 (17%) ø 30560 (5%) ø
functional_ut_file_manager ✔️ 388092 (18%) ø 30856 (5%) ø
functional_ut_firmware_kit ✔️ 379116 (18%) ø 30848 (5%) ø
functional_ut_imu_kit ✔️ 389120 (18%) ø 31296 (5%) ø
functional_ut_io_expander ✔️ 371176 (17%) ø 30576 (5%) ø
functional_ut_qdac ✔️ 372344 (17%) ø 30576 (5%) ø
spike_lk_activity_kit ✔️ 244964 (11%) ø 66488 (12%) ø
spike_lk_audio ✔️ 137724 (6%) ø 25168 (4%) ø
spike_lk_auto_charge - - 216728 (10%) - 36192 (6%) -
spike_lk_behavior_kit ✔️ 199220 (9%) ø 58680 (11%) ø
spike_lk_ble ✔️ 237980 (11%) ø 39416 (7%) ø
spike_lk_bluetooth ✔️ 92364 (4%) ø 22224 (4%) ø
spike_lk_cg_animations ✔️ 154664 (7%) ø 57240 (10%) ø
spike_lk_color_kit ✔️ 88544 (4%) ø 24376 (4%) ø
spike_lk_command_kit ✔️ 230772 (11%) ø 63744 (12%) ø
spike_lk_config_kit ✔️ 139780 (6%) ø 25184 (4%) ø
spike_lk_coreled ✔️ 88108 (4%) ø 24264 (4%) ø
spike_lk_core_touch_sensor ✔️ 93164 (4%) ø 22824 (4%) ø
spike_lk_event_queue ✔️ 84152 (4%) ø 22904 (4%) ø
spike_lk_file_manager_kit ✔️ 154560 (7%) ø 25520 (4%) ø
spike_lk_file_reception ✔️ 339964 (16%) ø 38448 (7%) ø
spike_lk_flash_memory ✔️ 86776 (4%) ø 22216 (4%) ø
spike_lk_fs ✔️ 179300 (8%) ø 57552 (10%) ø
spike_lk_imu_kit ✔️ 107504 (5%) ø 23744 (4%) ø
spike_lk_lcd ✔️ 174556 (8%) ø 57536 (10%) ø
spike_lk_led_kit ✔️ 115204 (5%) ø 25104 (4%) ø
spike_lk_log_kit ✔️ 84776 (4%) ø 23408 (4%) ø
spike_lk_motion_kit ✔️ 116312 (5%) ø 25712 (4%) ø
spike_lk_motors ✔️ 86400 (4%) ø 22248 (4%) ø
spike_lk_qdac ✔️ 91796 (4%) ø 22768 (4%) ø
spike_lk_reinforcer ✔️ 226308 (10%) ø 60416 (11%) ø
spike_lk_rfid ✔️ 84216 (4%) ø 22184 (4%) ø
spike_lk_sensors_battery ✔️ 87480 (4%) ø 23312 (4%) ø
spike_lk_sensors_imu_lsm6dsox ✔️ 98624 (4%) ø 23536 (4%) ø
spike_lk_sensors_imu_lsm6dsox_fusion_calibration ✔️ 105064 (5%) ø 23104 (4%) ø
spike_lk_sensors_light ✔️ 84072 (4%) ø 22216 (4%) ø
spike_lk_sensors_microphone ✔️ 84824 (4%) ø 22216 (4%) ø
spike_lk_sensors_temperature_humidity ✔️ 90616 (4%) ø 22192 (4%) ø
spike_lk_serial_number ✔️ 145028 (6%) ø 25256 (4%) ø
spike_lk_ticker_timeout ✔️ 82712 (3%) ø 22232 (4%) ø
spike_lk_touch_sensor_kit ✔️ 96668 (4%) ø 23392 (4%) ø
spike_lk_update_process_app_base ✔️ 157932 (7%) ø 26288 (5%) ø
spike_lk_update_process_app_update ✔️ 100456 (4%) ø 23240 (4%) ø
spike_lk_watchdog_isr ✔️ 87520 (4%) ø 24136 (4%) ø
spike_lk_wifi ✔️ 130984 (6%) ø 25528 (4%) ø
spike_mbed_blinky ✔️ 57616 (2%) ø 11496 (2%) ø
spike_mbed_watchdog_ticker_vs_thread ✔️ 84176 (4%) ø 23080 (4%) ø
spike_stl_cxxsupport ✔️ 83488 (3%) ø 22304 (4%) ø

🗺️ Map files diff output

spike_lk_auto_charge (click to expand)

Flash used: 216728 (10%) / total: 2097152
SRAM used: 36192 (6%) / total: 524288

Copy link

github-actions bot commented Dec 13, 2023

📈 Changes Impact Analysis Report

📌 Info

  • toolchain: GNU Arm Embedded Toolchain 10.3-2021.10 - 10.3.1 20210824
  • enable_log_debug: OFF
base head
branch develop yann/feature/charge/use-imukit-and-motors-to-go-on-charge
sha 8748b73 c1cc2f0
mbed mbed-os@master+fixes+gcc-11-support mbed-os@master+fixes+gcc-11-support
-std -std=c++20 -std=c++20

🤖 Firmware impact analysis

Target Flash Used (base/head) Flash Used Δ Flash Available (base/head) Static RAM (base/head) Static RAM Δ
bootloader 170952 (65%) ø 91192 (34%)
91192 (34%)
30960 (5%) ø
os 444232 (28%) ø 1120440 (71%)
1120440 (71%)
83384 (15%) ø
Click to show memory sections
| -          |      Hex |     Bytes |  KiB |
|------------|---------:|----------:|-----:|
| Flash      | 0x200000 | 2 097 152 | 2048 |
| SRAM       |  0x80000 |   524 288 |  512 |
| Bootloader |  0x40000 |   262 144 |  256 |
| Header     |   0x1000 |     4 096 |    4 |
| OS         | 0x17E000 | 1 564 672 | 1528 |
| Tail       |   0x1000 |     4 096 |    4 |
| Scratch    |  0x40000 |   262 144 |  256 |

🔬 Detailed impact analysis

Click to show detailed analysis for all targets
  • ✔️ - existing target
  • ✨ - new target
  • ⚰️ - deleted target
  • ✅ - files are the same
  • ❌ - files are different
Target Status .bin .map Total Flash (base/head) Total Flash Δ Static RAM (base/head) Static RAM Δ
LekaOS ✔️ 444232 (21%) ø 83384 (15%) ø
bootloader ✔️ 170952 (8%) ø 30960 (5%) ø
functional_ut_boost_ut ✔️ 394140 (18%) ø 20456 (3%) ø
functional_ut_core_imu ✔️ 377656 (18%) ø 20968 (3%) ø
functional_ut_deep_sleep_core_buffered_serial ✔️ 360600 (17%) ø 20440 (3%) ø
functional_ut_deep_sleep_core_motor ✔️ 364604 (17%) ø 20480 (3%) ø
functional_ut_deep_sleep_core_pwm ✔️ 366756 (17%) ø 20480 (3%) ø
functional_ut_deep_sleep_log_kit ✔️ 352568 (16%) ø 20408 (3%) ø
functional_ut_deep_sleep_mbed_hal ✔️ 354344 (16%) ø 20408 (3%) ø
functional_ut_file_manager ✔️ 376272 (17%) ø 20696 (3%) ø
functional_ut_firmware_kit ✔️ 367084 (17%) ø 20688 (3%) ø
functional_ut_imu_kit ✔️ 381572 (18%) ø 21144 (4%) ø
functional_ut_io_expander ✔️ 359576 (17%) ø 20424 (3%) ø
functional_ut_qdac ✔️ 360744 (17%) ø 20424 (3%) ø
spike_lk_activity_kit ✔️ 242096 (11%) ø 55824 (10%) ø
spike_lk_audio ✔️ 127092 (6%) ø 14592 (2%) ø
spike_lk_auto_charge - - 208308 (9%) - 25608 (4%) -
spike_lk_behavior_kit ✔️ 190144 (9%) ø 48104 (9%) ø
spike_lk_ble ✔️ 229600 (10%) ø 28472 (5%) ø
spike_lk_bluetooth ✔️ 82948 (3%) ø 11544 (2%) ø
spike_lk_cg_animations ✔️ 146968 (7%) ø 46544 (8%) ø
spike_lk_color_kit ✔️ 65840 (3%) ø 13744 (2%) ø
spike_lk_command_kit ✔️ 221416 (10%) ø 52656 (10%) ø
spike_lk_config_kit ✔️ 127324 (6%) ø 14360 (2%) ø
spike_lk_coreled ✔️ 76292 (3%) ø 13688 (2%) ø
spike_lk_core_touch_sensor ✔️ 80508 (3%) ø 12248 (2%) ø
spike_lk_event_queue ✔️ 74800 (3%) ø 12072 (2%) ø
spike_lk_file_manager_kit ✔️ 139528 (6%) ø 14440 (2%) ø
spike_lk_file_reception ✔️ 336000 (16%) ø 27792 (5%) ø
spike_lk_flash_memory ✔️ 63880 (3%) ø 11448 (2%) ø
spike_lk_fs ✔️ 176660 (8%) ø 47944 (9%) ø
spike_lk_imu_kit ✔️ 98860 (4%) ø 13032 (2%) ø
spike_lk_lcd ✔️ 164360 (7%) ø 46696 (8%) ø
spike_lk_led_kit ✔️ 103424 (4%) ø 14528 (2%) ø
spike_lk_log_kit ✔️ 63288 (3%) ø 12256 (2%) ø
spike_lk_motion_kit ✔️ 111276 (5%) ø 15168 (2%) ø
spike_lk_motors ✔️ 62928 (3%) ø 11488 (2%) ø
spike_lk_qdac ✔️ 78852 (3%) ø 11808 (2%) ø
spike_lk_reinforcer ✔️ 218648 (10%) ø 49840 (9%) ø
spike_lk_rfid ✔️ 79084 (3%) ø 11504 (2%) ø
spike_lk_sensors_battery ✔️ 78500 (3%) ø 12600 (2%) ø
spike_lk_sensors_imu_lsm6dsox ✔️ 89468 (4%) ø 12824 (2%) ø
spike_lk_sensors_imu_lsm6dsox_fusion_calibration ✔️ 97916 (4%) ø 12952 (2%) ø
spike_lk_sensors_light ✔️ 60056 (2%) ø 11440 (2%) ø
spike_lk_sensors_microphone ✔️ 72496 (3%) ø 11504 (2%) ø
spike_lk_sensors_temperature_humidity ✔️ 67272 (3%) ø 11424 (2%) ø
spike_lk_serial_number ✔️ 133084 (6%) ø 14304 (2%) ø
spike_lk_ticker_timeout ✔️ 69052 (3%) ø 11632 (2%) ø
spike_lk_touch_sensor_kit ✔️ 87896 (4%) ø 12824 (2%) ø
spike_lk_update_process_app_base ✔️ 145620 (6%) ø 15576 (2%) ø
spike_lk_update_process_app_update ✔️ 77632 (3%) ø 12352 (2%) ø
spike_lk_watchdog_isr ✔️ 80196 (3%) ø 13288 (2%) ø
spike_lk_wifi ✔️ 116544 (5%) ø 14808 (2%) ø
spike_mbed_blinky ✔️ 58032 (2%) ø 11400 (2%) ø
spike_mbed_watchdog_ticker_vs_thread ✔️ 63208 (3%) ø 12448 (2%) ø
spike_stl_cxxsupport ✔️ 58456 (2%) ø 11400 (2%) ø

🗺️ Map files diff output

spike_lk_auto_charge (click to expand)

Flash used: 208308 (9%) / total: 2097152
SRAM used: 25608 (4%) / total: 524288

@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch 3 times, most recently from 06ce90e to dc99b43 Compare December 13, 2023 12:00
@YannLocatelli YannLocatelli changed the title Yann/feature/charge/use imukit and motors to go on charge Spike autocharge Dec 13, 2023
@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch from dc99b43 to a049b4a Compare December 13, 2023 15:45
Copy link
Contributor

@HPezz HPezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a nice way for me to read again a bit of Cpp 👍
Just one readability remark about the if/else nesting in the Seal strategy

Comment on lines 56 to 68
if (is_right_tilted) {
if (should_move_forward) {
spinRight(kMinPwmOutput, kMinPwmOutput + speed_offset);
} else {
spinLeft(kMinPwmOutput, kMinPwmOutput + speed_offset);
}
} else {
if (should_move_forward) {
spinLeft(kMinPwmOutput + speed_offset, kMinPwmOutput);
} else {
spinRight(kMinPwmOutput + speed_offset, kMinPwmOutput);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since I've coded in C++ !! I kind of remember of us not using ternary operator for a reason but can you put this part in a independant function ?

void SealStrategy::performSpin(bool is_right_tilted, bool should_move_forward, float speed_offset) {
    if (is_right_tilted) {
        should_move_forward ? spinRight(kMinPwmOutput, kMinPwmOutput + speed_offset)
                            : spinLeft(kMinPwmOutput, kMinPwmOutput + speed_offset);
    } else {
        should_move_forward ? spinLeft(kMinPwmOutput + speed_offset, kMinPwmOutput)
                            : spinRight(kMinPwmOutput + speed_offset, kMinPwmOutput);
    }
}

This would give a nice :

if (abs_float(angles.roll) > kRollTolerance) {
    auto speed_offset = convertToPwmFrom(angles.roll > 0 ? angles.roll : -angles.roll);
    performSpin(is_right_tilted, should_move_forward, speed_offset);

} else if (abs_float(angles.pitch) > kPitchTolerance) {
	auto speed = convertToPwmFrom(angles.pitch > 0 ? angles.pitch : -angles.pitch);
	should_move_forward ? moveForward(speed) : moveBackward(speed);

} else {
	stopMotors();

}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Ternary was mostly not used since it might be hard to read and understand. However I never used them to call a function, only to set variable so I don't know if you can use it as is.

I will let them in if/else statement since it is easier to read and understand what happened to me

I will add your suggestion to move in function these whole if/else statement

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch from 29b5d0f to 1799df5 Compare January 23, 2024 15:01
YannLocatelli and others added 4 commits February 1, 2024 14:35
An original suggestion from @HPezz

Co-Authored-By: Hugo Pezziardi <[email protected]>
An original suggestion from @HPezz

Co-Authored-By: Hugo Pezziardi <[email protected]>
@YannLocatelli YannLocatelli force-pushed the yann/feature/charge/use-imukit-and-motors-to-go-on-charge branch from 1799df5 to c1cc2f0 Compare February 1, 2024 13:35
Copy link

sonarqubecloud bot commented Feb 1, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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