diff --git a/.github/workflows/build_base_controller.yml b/.github/workflows/build_base_controller.yml new file mode 100644 index 00000000..d9119314 --- /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/scripts/base_controller + pio run \ No newline at end of file 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_; 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 diff --git a/raspi-setup.sh b/raspi-setup.sh new file mode 100755 index 00000000..b8aab663 --- /dev/null +++ b/raspi-setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# 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 -y 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_ws +rosdep install --from-paths src --ignore-src -r -y + +catkin build