duckietown / duckietown-shell-commands

Commands for the Duckietown Shell
4 stars 2 forks source link

Bug fix hardcoded batt ver #417

Closed jasonhu5 closed 1 year ago

jasonhu5 commented 1 year ago

prepare shell commands for new dt-firmware-upgrade image

Tested: upgrade pcb21 battery from firmware v2.0.2 to v2.0.3

dts duckiebot battery upgrade autobot33
Duckietown Shell (v5.5.9)
INFO:dts:Commands version: daffy-staging
INFO:dts:Checking for updates in the Duckietown shell commands repo...
INFO:dts:Duckietown shell commands are up-to-date.
==================================================================================================================================

    An Autolab is a smart-city extension of any Duckietown. Autolabs can localize and communicate with Duckiebots. Learn more:

    https://cutt.ly/autolab-docs

==================================================================================================================================
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.4) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
DEBUG:duckietown_docker_utils:duckietown_docker_utils version 6.1.1 path /home/sjhu/Projects/DT_testing/daffy/stage/src/duckietown-docker-utils/src
WARNING:dts:

DO NOT unplug the battery, turn off your robot, or interrupt this command. It might cause irreversible damage to the battery.

INFO:dts:Releasing battery...
INFO:dts:Battery released!
INFO:dts:Checking battery...
INFO:dts:Fetching PCB version...
==> Entrypoint
   INFO: The environment variable VEHICLE_NAME is not set. Using '199ba9f90eaf'.
   INFO: Network configured successfully.
WARNING: robot_type file does not exist. Using 'duckiebot' as default type.
WARNING: robot_configuration file does not exist.
WARNING: robot_hardware file does not exist.
<== Entrypoint
==> Launching app...
INFO:UpgradeHelper:App status changed [INITIALIZING] -> [RUNNING]

Duckietown Battery Firmware Upgrade Utility.
Version 0.0.2

INFO:UpgradeHelper:Battery found at /dev/ttyACM0.
INFO:UpgradeHelper:Fetched battery PCB version: 21

INFO:dts:[Success] The battery PCB version is: v21
INFO:dts:Checking for available battery firmware updates...
==> Entrypoint
   INFO: The environment variable VEHICLE_NAME is not set. Using '07ca1bddef25'.
   INFO: Network configured successfully.
WARNING: robot_type file does not exist. Using 'duckiebot' as default type.
WARNING: robot_configuration file does not exist.
WARNING: robot_hardware file does not exist.
<== Entrypoint
==> Launching app...
INFO:UpgradeHelper:App status changed [INITIALIZING] -> [RUNNING]

Duckietown Battery Firmware Upgrade Utility.
Version 0.0.2

INFO:UpgradeHelper:Battery found at /dev/ttyACM0.
INFO:UpgradeHelper:PCB version supplied: 21

Duckietown Battery:
    - Current version:   v2.0.2
    - Available version: v2.0.3

WARNING:dts:An updated firmware is available.
Do you want to update the battery now? (y=Yes, n=No) [n]: y
INFO:dts:Switch your battery to "Boot Mode" by double pressing the button on the battery.
Press ENTER when done, 'q' to quit...
INFO:dts:Checking if the battery has "Boot Mode" activated, please wait...
INFO:dts:Updating battery...
   INFO: The environment variable VEHICLE_NAME is not set. Using 'cf44c7e6db94'.
   INFO: Network configured successfully.
WARNING: robot_type file does not exist. Using 'duckiebot' as default type.
WARNING: robot_configuration file does not exist.
WARNING: robot_hardware file does not exist.
<== Entrypoint
==> Launching app...
INFO:UpgradeHelper:App status changed [INITIALIZING] -> [RUNNING]

Duckietown Battery Firmware Upgrade Utility.
Version 0.0.2

INFO:UpgradeHelper:PCB version supplied: 21
INFO:UpgradeHelper:Downloading firmware version v2.0.3...
INFO:UpgradeHelper:Firmware downloaded!
INFO:UpgradeHelper:Using firmware file: /tmp/battery_pcb21_fw_v203.bin
INFO:UpgradeHelper:Flashing firmware to device ttyACM0...
Atmel SMART device 0x10030000 found
Erase flash
done in 0.185 seconds

Write 12196 bytes to flash (191 pages)
[==============================] 100% (191/191 pages)
done in 2.303 seconds

Verify 12196 bytes of flash
[==============================] 100% (191/191 pages)
Verify successful
done in 0.066 seconds
CPU reset.
INFO:UpgradeHelper:Done!
INFO:dts:Battery on 'autobot33' successfully updated!
INFO:dts:Re-engaging battery (this might take a while)...
INFO:dts:Waiting for container "device-health" to become healthy. It may take up to 2 minutes.
INFO:dts:Battery returned to work happier than ever!
jasonhu5 commented 1 year ago

After discussing with AfD, merging this on his behalf