From 11f78adaef0da5cf3be0c6053a16f023ae780d69 Mon Sep 17 00:00:00 2001 From: santeriok Date: Thu, 8 Feb 2024 09:24:50 +0200 Subject: [PATCH 1/9] unsigned long -> int --- .../base_controller/lib/base_controller/base_controller.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h b/diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h index 2ca139bf..b0bfb7f7 100644 --- a/diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h +++ b/diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h @@ -342,7 +342,7 @@ namespace diffbot { // Measured left and right joint states (angular position (rad) and angular velocity (rad/s)) diffbot::JointState joint_state_left_, joint_state_right_; - unsigned long encoder_resolution_; + int encoder_resolution_; ros::Subscriber> sub_reset_encoders_; From 597150beaf6bf4f9c8bcad30d17dbefb2ab00517 Mon Sep 17 00:00:00 2001 From: santeriok Date: Thu, 8 Feb 2024 09:25:01 +0200 Subject: [PATCH 2/9] Add teensy40 --- diffbot_base/scripts/base_controller/platformio.ini | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/diffbot_base/scripts/base_controller/platformio.ini b/diffbot_base/scripts/base_controller/platformio.ini index f80398b8..91cc29a1 100644 --- a/diffbot_base/scripts/base_controller/platformio.ini +++ b/diffbot_base/scripts/base_controller/platformio.ini @@ -9,12 +9,22 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = teensy31 +default_envs = teensy40 [env:teensy31] platform = teensy board = teensy31 framework = arduino +lib_deps = + frankjoshua/Rosserial Arduino Library@^0.9.1 + ./lib + adafruit/Adafruit Motor Shield V2 Library@^1.0.11 + Wire + +[env:teensy40] +platform = teensy +board = teensy40 +framework = arduino lib_deps = frankjoshua/Rosserial Arduino Library@^0.9.1 ./lib From 5d6eebf0989193064bf94afe131e47b021058f27 Mon Sep 17 00:00:00 2001 From: santeriok Date: Thu, 8 Feb 2024 09:37:51 +0200 Subject: [PATCH 3/9] Add script for raspi setup --- raspi-setup.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 raspi-setup.sh diff --git a/raspi-setup.sh b/raspi-setup.sh new file mode 100644 index 00000000..54ec7a0a --- /dev/null +++ b/raspi-setup.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# update & upgrade # +sudo apt update +sudo apt upgrade + +sudo apt -y install i2c-tools curl + +# Add i2c support to /boot/firmware/config.txt +# dtparam=i2c0=on +sudo sed -i '/dtparam=i2c0=on/s/^#//g' /boot/firmware/config.txt + +# ROS Noetic setup +sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +sudo apt -y update +sudo apt -y install ros-noetic-ros-base + +sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-vcstool \ + python3-rosdep python3-catkin-tools build-essential + +sudo rosdep init +rosdep update +echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +source ~/.bashrc + +cd .. +catkin build From 452c37fc57c9fc677226132580f106cd54b05aea Mon Sep 17 00:00:00 2001 From: santeriok Date: Thu, 8 Feb 2024 09:38:33 +0200 Subject: [PATCH 4/9] Make raspi setup executable --- raspi-setup.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 raspi-setup.sh diff --git a/raspi-setup.sh b/raspi-setup.sh old mode 100644 new mode 100755 From d10162421bf0583ad58814a4006d45e290e022f4 Mon Sep 17 00:00:00 2001 From: santeriok Date: Thu, 8 Feb 2024 09:39:11 +0200 Subject: [PATCH 5/9] Run with bash --- raspi-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raspi-setup.sh b/raspi-setup.sh index 54ec7a0a..d7e4192e 100755 --- a/raspi-setup.sh +++ b/raspi-setup.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # update & upgrade # sudo apt update sudo apt upgrade From cd35b3c45f8208f020a5f985ac53c77547d0c041 Mon Sep 17 00:00:00 2001 From: santeriok Date: Wed, 21 Feb 2024 09:59:27 +0200 Subject: [PATCH 6/9] Raspi setup script --- raspi-setup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/raspi-setup.sh b/raspi-setup.sh index d7e4192e..b8aab663 100755 --- a/raspi-setup.sh +++ b/raspi-setup.sh @@ -15,7 +15,7 @@ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo ap sudo apt -y update sudo apt -y install ros-noetic-ros-base -sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-vcstool \ +sudo apt -y install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-vcstool \ python3-rosdep python3-catkin-tools build-essential sudo rosdep init @@ -23,5 +23,7 @@ rosdep update echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc -cd .. +cd ~/catkin_ws +rosdep install --from-paths src --ignore-src -r -y + catkin build From e82ad1de1eccf66ffdde1b6d38a0f890b3f726f8 Mon Sep 17 00:00:00 2001 From: santeriok Date: Wed, 21 Feb 2024 13:44:48 +0200 Subject: [PATCH 7/9] Add github action to build base controller for teensy4 --- .github/workflows/build_base_controller.yml | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build_base_controller.yml diff --git a/.github/workflows/build_base_controller.yml b/.github/workflows/build_base_controller.yml new file mode 100644 index 00000000..0de0f0d5 --- /dev/null +++ b/.github/workflows/build_base_controller.yml @@ -0,0 +1,32 @@ +name: Build base controller +on: + push: + branches: + - "**" + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build_teensy_40: + runs-on: ubuntu-latest + strategy: + fail-fast: true + + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install PlatformIO Core + run: pip install --upgrade platformio + + - name: Build PlatformIO Project + run: | + cd diffbot_base/scritps/base_controller + pio run \ No newline at end of file From 6c0b66895e2442c70c25746fd26ce9a475332be9 Mon Sep 17 00:00:00 2001 From: santeriok Date: Wed, 21 Feb 2024 13:46:25 +0200 Subject: [PATCH 8/9] Change folder --- .github/workflows/build_base_controller.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_base_controller.yml b/.github/workflows/build_base_controller.yml index 0de0f0d5..0ac6db28 100644 --- a/.github/workflows/build_base_controller.yml +++ b/.github/workflows/build_base_controller.yml @@ -28,5 +28,6 @@ jobs: - name: Build PlatformIO Project run: | - cd diffbot_base/scritps/base_controller + ls + cd diffbot/diffbot_base/scritps/base_controller pio run \ No newline at end of file From 3a43ea78fe3453883b1a9c47ebef1c88d84c66ba Mon Sep 17 00:00:00 2001 From: santeriok Date: Wed, 21 Feb 2024 13:48:00 +0200 Subject: [PATCH 9/9] typo --- .github/workflows/build_base_controller.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_base_controller.yml b/.github/workflows/build_base_controller.yml index 0ac6db28..d9119314 100644 --- a/.github/workflows/build_base_controller.yml +++ b/.github/workflows/build_base_controller.yml @@ -28,6 +28,5 @@ jobs: - name: Build PlatformIO Project run: | - ls - cd diffbot/diffbot_base/scritps/base_controller + cd diffbot_base/scripts/base_controller pio run \ No newline at end of file