Motor drive: Difference between revisions

From Rsewiki
 
(3 intermediate revisions by the same user not shown)
Line 16: Line 16:
  chmod +x TeensyduinoInstall.linuxaarch64
  chmod +x TeensyduinoInstall.linuxaarch64
  ./TeensyduinoInstall.linuxaarch64
  ./TeensyduinoInstall.linuxaarch64
Microsoft Visual Studio Code with PlatformIO can also work, but it needs the same libraries (and a bit more).


=== Additional Arduino libraries ===
=== Additional Arduino libraries ===
Line 23: Line 25:
* Adafruit-GFX-Library to get the paint functions for the display
* Adafruit-GFX-Library to get the paint functions for the display
* Adafruit_SSD1306 to get the specifics for the used display
* Adafruit_SSD1306 to get the specifics for the used display
cd ~/
mkdir -p git
cd git
  git clone https://github.com/adafruit/Adafruit_BusIO.git
  git clone https://github.com/adafruit/Adafruit_BusIO.git
  git clone https://github.com/adafruit/Adafruit_SSD1306.git
  git clone https://github.com/adafruit/Adafruit_SSD1306.git
Line 46: Line 52:
* The motor_driver firmware for Teensy 4.1
* The motor_driver firmware for Teensy 4.1


Other parts will be described on other pages, pt. (April 2024) there are also:
Other parts will be described on other pages.
* The teensy_interface for a Raspberry - for now, not fully compatible with the firmware
* The teensy_interface from Teensy board(s) to MQTT
* ROS2-iron code starts with a YDLidar driver and is in the ROS2 directory. Further, the slam toolbox and the base ROS2-iron compiled successfully on Raspberry Pi 5 on Raspberry OS 64bit.
* ROS2 code starts with a YDLidar driver and is in the ROS2 directory
* Some 3D print STL files.
* some other minor stuff.


== Moror drive ==
== Moror drive ==
Line 67: Line 71:
  Release "power reset" when "alive" LED starts blinking
  Release "power reset" when "alive" LED starts blinking


=== Raspberry 5 ===
=== Compile on Raspberry Pi 5 ===


Compiling motor drive on the Raspberry 5 failed in one of the Teensy libraries.
Compiling motor drive on the Raspberry 5 failed in one of the Teensy libraries.

Latest revision as of 11:57, 3 October 2024

Back to scorpi

Load arduino and Teensyduino

Install Arduino version 1.8.19 for the platform, find it here https://www.arduino.cc/en/software

Unpack in the Downloads directory (to fit the path in the Makefile)

cd ~/Downloads
tar -xf arduino-1.8.19-linuxaarch64.tar.xz

Install Teensyduino from https://www.pjrc.com/teensy/td_download.html

Make the installer executable and install it on top of the Arduino installation.

chmod +x TeensyduinoInstall.linuxaarch64
./TeensyduinoInstall.linuxaarch64

Microsoft Visual Studio Code with PlatformIO can also work, but it needs the same libraries (and a bit more).

Additional Arduino libraries

Additional libraries from Ardufruit are needed for the small display:

  • Adafruit_BusIO to get additional services from the I2C interface
  • Adafruit-GFX-Library to get the paint functions for the display
  • Adafruit_SSD1306 to get the specifics for the used display
cd ~/
mkdir -p git
cd git
git clone https://github.com/adafruit/Adafruit_BusIO.git
git clone https://github.com/adafruit/Adafruit_SSD1306.git
git clone https://github.com/adafruit/Adafruit-GFX-Library
git clone https://github.com/pfeerick/elapsedMillis.git

The obtained libraries should be included in the Arduino/Teensyduino library list, e.g. if the GIT repositories are in a ~/git directory:

cd Arduino-1.8.19/hardware/teensy/avr/libraries
ln -s ~/git/Adafruit_BusIO
ln -s ~/git/Adafruit-GFX-Library
ln -s ~/git/Adafruit_SSD1306
ln -s ~/git/elapsedMillis

Get code from SVN

The code is available on SVN:

cd
svn checkout svn://repos.gbar.dtu.dk/jcan/scorpi

The main package for this page is:

  • The motor_driver firmware for Teensy 4.1

Other parts will be described on other pages.

  • The teensy_interface from Teensy board(s) to MQTT
  • ROS2 code starts with a YDLidar driver and is in the ROS2 directory

Moror drive

Compile and upload to Teensy.

cd ~/scorpi/motor_drive
make

This should produce a file called motor_drive.hex, ready to be uploaded:

NB! Before you upload, press the power reset button to avoid power shutdown.

Press had hold "power reset"
make upload
Release "power reset" when "alive" LED starts blinking

Compile on Raspberry Pi 5

Compiling motor drive on the Raspberry 5 failed in one of the Teensy libraries.

This was fixed by renaming a few files in the library:

cd ~/Downloads/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36/
mv BluetoothConnection.cpp BluetoothConnection.cpp.not  
mv bluetooth.cpp bluetooth.cpp.not
mv joystick.cpp joystick.cpp.not

It was probably in the Bluetooth part, but I failed to remove Bluetooth from joystick.cpp, so all USB-host joystick support has gone.

No joystick is OK for this project.

The code compiles but does not run! The same code runs fine when compiled on a normal Ubuntu.