Skip to content

Commit

Permalink
Arduino Opta support (#1867) (#1876)
Browse files Browse the repository at this point in the history
* added opta, wifi test needed

* added ci

* updated readme

* fix example

* fix define ARDUINO_OPTA

* added ethernet

(cherry picked from commit 1ce09cc)

Co-authored-by: Giovanni Bruno <[email protected]>
  • Loading branch information
mergify[bot] and gbr1 authored Nov 25, 2024
1 parent 448bb22 commit 7cbbf5b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
arduino-cli core install arduino:mbed_giga -v
arduino-cli core install arduino:mbed_rp2040 -v
arduino-cli core install arduino:mbed_portenta -v
arduino-cli core install arduino:mbed_opta -v
arduino-cli core install arduino:renesas_uno -v
arduino-cli core install arduino:mbed_nano -v
arduino-cli core install esp32:esp32 -v
Expand Down Expand Up @@ -92,6 +93,10 @@ jobs:
arduino-cli compile --fqbn arduino:renesas_uno:minima /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_ethernet -v
# Build micro-ros_publisher-wifi_at for WiFi non-native board with ESP-AT
arduino-cli compile --fqbn arduino:mbed_rp2040:pico /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi_at -v
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Community contributed boards are:
| [Arduino Giga R1](https://store.arduino.cc/products/giga-r1-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
| [Arduino UNO R4 WiFi](https://store.arduino.cc/products/uno-r4-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
| [Arduino UNO R4 Minima](https://store.arduino.cc/products/uno-r4-minima) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
| [Arduino Opta](https://store.arduino.cc/products/opta-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |


You can find the available precompiled ROS 2 types for messages and services in [available_ros2_types](available_ros2_types).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <rclc/executor.h>
#include <std_msgs/msg/int32.h>

#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7)
#error This example is only available for Arduino Portenta, Arduino Teensy41 and STM32F4
#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_OPTA)
#error This example is only available for Arduino Portenta, Arduino Teensy41, STM32F4 and Arduino OPTA
#endif

#if defined(ARDUINO_TEENSY41)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <std_msgs/msg/int32.h>

#if !defined(ESP32) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_GIGA) && !defined(ARDUINO_NANO_RP2040_CONNECT) && !defined(ARDUINO_WIO_TERMINAL) && !defined(ARDUINO_UNOR4_WIFI)
#error This example is only available for Arduino Portenta, Arduino Giga R1, Arduino Nano RP2040 Connect, ESP32 Dev module, Wio Terminal and Arduino Uno R4 WiFi
#if !defined(ESP32) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_GIGA) && !defined(ARDUINO_NANO_RP2040_CONNECT) && !defined(ARDUINO_WIO_TERMINAL) && !defined(ARDUINO_UNOR4_WIFI) && !defined(ARDUINO_OPTA)
#error This example is only available for Arduino Portenta, Arduino Giga R1, Arduino Nano RP2040 Connect, ESP32 Dev module, Wio Terminal, Arduino Uno R4 WiFi and Arduino OPTA WiFi
#endif

rcl_publisher_t publisher;
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ paragraph=micro-ROS Arduino library
url=https://github.com/micro-ROS/micro_ros_arduino
precompiled=true
category=Other
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta,mbed_giga,renesas_uno
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta,mbed_giga,renesas_uno,mbed_opta
10 changes: 5 additions & 5 deletions src/micro_ros_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ static inline void set_microros_transports(){
#include <NativeEthernet.h>
#endif

#if defined(TARGET_PORTENTA_H7_M7)
#if defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
#include <PortentaEthernet.h>
#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
extern "C" bool arduino_native_ethernet_udp_transport_open(struct uxrCustomTransport * transport);
extern "C" bool arduino_native_ethernet_udp_transport_close(struct uxrCustomTransport * transport);
extern "C" size_t arduino_native_ethernet_udp_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
Expand Down Expand Up @@ -95,9 +95,9 @@ static inline void set_microros_native_ethernet_udp_transports(byte mac[], IPAdd

#endif

#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI)
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_OPTA)

#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
Expand All @@ -116,7 +116,7 @@ extern "C" bool arduino_wifi_transport_open(struct uxrCustomTransport * transpor
extern "C" bool arduino_wifi_transport_close(struct uxrCustomTransport * transport);
extern "C" size_t arduino_wifi_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
extern "C" size_t arduino_wifi_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err);
#ifndef TARGET_PORTENTA_H7_M7
#if !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_OPTA)
struct micro_ros_agent_locator {
IPAddress address;
int port;
Expand Down
4 changes: 2 additions & 2 deletions src/native_ethernet_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include <NativeEthernet.h>
#include <micro_ros_arduino.h>
#endif
#ifdef TARGET_PORTENTA_H7_M7
#if defined(TARGET_PORTENTA_H7_M7 ) || defined(ARDUINO_OPTA)
#include <Arduino.h>
#include <EthernetUdp.h>
#include <micro_ros_arduino.h>
#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
extern "C" {

#include <stdbool.h>
Expand Down
4 changes: 2 additions & 2 deletions src/wifi_transport.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI)
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_OPTA)
#include <Arduino.h>


#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
Expand Down

0 comments on commit 7cbbf5b

Please sign in to comment.