-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- pico fw update - start ros bash - xesc2tcp by jkaflik (ClemensElflein/OpenMowerOS#5)
- Loading branch information
1 parent
239a5e5
commit ab467aa
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
source /boot/openmower/mower_config.txt | ||
|
||
# remove old firmware | ||
rm -rf firmware_download | ||
mkdir firmware_download | ||
cd firmware_download | ||
|
||
# Download the latest firmware | ||
echo "Fetching Firmware" | ||
wget https://github.com/ClemensElflein/OpenMower/releases/download/latest/firmware.zip | ||
|
||
unzip firmware.zip | ||
|
||
cd .. | ||
|
||
echo "Flashing Firmware: ./firmware_download/firmware/$OM_HARDWARE_VERSION/firmware.elf" | ||
sudo ./upload_firmware.sh ./firmware_download/firmware/$OM_HARDWARE_VERSION/firmware.elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# This script starts OpenOCD on the pi and allows external connections. | ||
# This way you can use VS code to remotely debug the Pico code. | ||
|
||
echo "10" > /sys/class/gpio/export | ||
echo "out" > /sys/class/gpio/gpio10/direction | ||
echo "1" > /sys/class/gpio/gpio10/value | ||
openocd -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg -c "bindto 0.0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# Starts a bash in the container. | ||
# Use this for ROS specific commands (e.g. rostopic echo) | ||
|
||
sudo podman exec -it openmower-debug /openmower_entrypoint.sh ${@:-/bin/bash} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# Starts a bash in the container. | ||
# Use this for ROS specific commands (e.g. rostopic echo) | ||
|
||
sudo podman exec -it openmower /openmower_entrypoint.sh ${@:-/bin/bash} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
# This script uploads new firmware to the Pico. | ||
# You need to provide the .elf file, not the .uf2 | ||
# run as root! | ||
|
||
echo "10" > /sys/class/gpio/export | ||
echo "out" > /sys/class/gpio/gpio10/direction | ||
echo "1" > /sys/class/gpio/gpio10/value | ||
openocd -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg -c "program $1 verify reset exit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
PORT=1234 | ||
|
||
declare -A DEVICE_MAP=( | ||
["left"]="/dev/ttyAMA4" | ||
["right"]="/dev/ttyAMA2" | ||
["mower"]="/dev/ttyAMA3" | ||
) | ||
|
||
if [[ -z $1 ]]; then | ||
echo "Error: Argument required." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z ${DEVICE_MAP[$1]} ]]; then | ||
echo "Error: Invalid argument. Valid values are: left, right, mower." | ||
exit 1 | ||
fi | ||
|
||
DEVICE=${DEVICE_MAP[$1]} | ||
|
||
running=true | ||
trap 'echo "Interrupt received! Stopping..."; running=false' SIGINT | ||
|
||
echo "Running socat for device: ${DEVICE} on port: ${PORT}..." | ||
|
||
while $running; do | ||
sudo socat TCP-LISTEN:${PORT},reuseaddr,fork FILE:${DEVICE},b115200,cs8,raw,echo=0 || true | ||
done |