Skip to content

Commit

Permalink
Merge pull request #21 from arduino/dev
Browse files Browse the repository at this point in the history
ver 1.0.1
  • Loading branch information
gbr1 authored Apr 11, 2024
2 parents 66054ca + 8a33b46 commit 80e6656
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 11 deletions.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@



## How to Install Micropython library
## How to Install the Micropython library

### 1. install mpremote

[mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html) is needed to upload files on the [Arduino® Nano ESP32](https://store.arduino.cc/products/nano-esp32?gad_source=1&gclid=Cj0KCQiA2KitBhCIARIsAPPMEhLtIxV_s7KyLJO4-69RdR1UeFTdgGK_XmI8w7xdbur4gs1oJU4Jl68aAhbaEALw_wcB).
Minimum suggested mpremote release is 1.22.0

```shell
(venv)$ pip install mpremote
Expand All @@ -34,13 +35,26 @@ Windows
***Note: The -p parameter is optional***


__NOTE: DO NOT USE LAB FOR MICROPYTHON TO UPLOAD BIN FILES__
__WARNING: do not open bin files with Arduino Lab for Micropython 0.8.0 because they will be corrupted__

### 2.1 mip (MicroPython Package Manager)
This is the recommended method for boards which can connect to Internet. Make sure your board is connected to the Internet and
run the following MicroPython script using your favourite editor:

```py
import mip

mip.install('github:arduino/arduino-alvik-mpy')

```

<br>
<br>

### 3. Update firmware on your Arduino® Alvik

Download the latest [Arduino Alvik Carrier Firmware code](https://github.com/arduino-libraries/Arduino_AlvikCarrier) (to compile the firmware using Arduino IDE) or the [pre-compiled firmware](https://github.com/arduino-libraries/Arduino_AlvikCarrier/releases/latest)

Go into `utilities` folder and run:
```shell
Linux
Expand Down Expand Up @@ -142,4 +156,15 @@ It is possible to stop the robot at any time by pressing the `CANCEL touch butto
<br>
<br>

__Note: not open bin files with Arduino Lab for Micropython because they will be corrupted__
__WARNING: do not open bin files with Arduino Lab for Micropython 0.8.0 because they will be corrupted__


<br>
<br>
<br>


## Useful links
- [Arduino_Alvik](https://github.com/arduino-libraries/Arduino_Alvik): Arduino library required to program Alvik
- [Arduino_AlvikCarrier](https://github.com/arduino-libraries/Arduino_AlvikCarrier): Arduino library required to build the firmware
- [Arduino Alvik product page](https://store.arduino.cc/pages/alvik)
9 changes: 9 additions & 0 deletions arduino_alvik/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
"""
Arduino Alvik micropython library
"""

__author__ = "Lucio Rossi <l.rossi@arduino.cc>, Giovanni Bruno <g.bruno@arduino.cc>"
__license__ = "MPL 2.0"
__version__ = "1.0.1"
__maintainer__ = "Lucio Rossi <l.rossi@arduino.cc>, Giovanni Bruno <g.bruno@arduino.cc>"

from .arduino_alvik import *
29 changes: 23 additions & 6 deletions arduino_alvik/arduino_alvik.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ def is_target_reached(self) -> bool:
if self._last_ack == self._waiting_ack:
self._packeter.packetC1B(ord('X'), ord('K'))
uart.write(self._packeter.msg[0:self._packeter.msg_size])
sleep_ms(100)
self._last_ack = 0x00
self._waiting_ack = None
self._last_ack = 0x00
sleep_ms(100)
return True
return False

Expand Down Expand Up @@ -971,10 +971,27 @@ def print_status(self):
Prints the Alvik status
:return:
"""
for a in vars(self):
if str(a).startswith('_'):
continue
print(f'{str(a).upper()} = {getattr(self, str(a))}')
print('---ALVIK STATUS---')
print(f'VERSION: {self._version}')

print('---SENSORS---')
print(f'TOF: T:{self._top_tof} B:{self._bottom_tof} L:{self._left_tof} CL:{self._center_left_tof}' +
f' C:{self._center_tof} CR:{self._center_right_tof} R:{self._right_tof}')
print(f'LINE: L:{self._left_line} C:{self._center_line} R:{self._right_line}')
print(f'ACC: X:{self._ax} Y:{self._ay} Z:{self._az}')
print(f'GYR: X:{self._gx} Y:{self._gy} Z:{self._gz}')
print(f'POS: X:{self._x} Y:{self._y} TH:{self._theta}')
print(f'IMU: ROLL:{self._roll} PITCH:{self._pitch} YAW:{self._yaw}')
print(f'COLOR: R:{self._red} G:{self._green} B:{self._blue}')
print(f'BATT(%) {self._battery_perc}')

print('---COMMUNICATION---')
print(f'TOUCH BYTE: {self._touch_byte}')
print(f'LAST ACK: {self._last_ack}')

print('---MOTORS---')
print(f'LINEAR VEL: {self._linear_velocity}')
print(f'ANGULAR VEL: {self._angular_velocity}')

def on_touch_ok_pressed(self, callback: callable, args: tuple = ()) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
["arduino_alvik/stm32_flash.py", "github:arduino/arduino-alvik-mpy/arduino_alvik/stm32_flash.py"]
],
"deps": [
["github:arduino/ucPack-mpy", "0.1.5"]
["github:arduino/ucPack-mpy", "0.1.6"]
],
"version": "1.0.0"
"version": "1.0.1"
}

0 comments on commit 80e6656

Please sign in to comment.