-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed time.h import, added Arduino UNO R4 minima (USB), Arduino UNO R…
…4 WiFi (USB and WiFi), Arduino Giga R1 (USB and WiFi) (backport #1712) (#1864) * fixed time.h import, added Arduino UNO R4 minima (USB), Arduino UNO R4 WiFi (USB and WiFi), Arduino Giga R1 (USB and WiFi) (#1712) * fixes time.h import * added support for Arduino GIGA R1 over WiFi * examples with giga r1 * uint -> uint32_t, added uno r4 wifi * added uno r4 into the example * added uno r4 family into library properties * led builtin check * added boards into readme * updated ci * fix typo * updated cli version * force update index * reverted cli (cherry picked from commit e347a4a) # Conflicts: # .github/workflows/ci.yml # README.md # examples/micro-ros_publisher_wifi/micro-ros_publisher_wifi.ino # examples/micro-ros_publisher_wifi_at/micro-ros_publisher_wifi_at.ino # src/micro_ros_arduino.h # src/wifi_transport.cpp * Fix rebase * Update ci.yml --------- Co-authored-by: Giovanni Bruno <[email protected]> Co-authored-by: Pablo Garrido <[email protected]>
- Loading branch information
1 parent
d7a6e11
commit 41bc42c
Showing
8 changed files
with
146 additions
and
24 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 |
---|---|---|
|
@@ -35,10 +35,15 @@ jobs: | |
curl -fsSL https://www.pjrc.com/teensy/package_teensy_index.json -o /github/home/.arduino15/package_teensy_index.json | ||
curl -fsSL https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json -o /github/home/.arduino15/package_seeeduino_boards_index.json | ||
export PATH=$PATH:/github/workspace/bin:/__w/micro_ros_arduino/micro_ros_arduino/bin | ||
arduino-cli core install OpenCR:OpenCR -v | ||
arduino-cli core install arduino:samd -v | ||
arduino-cli core install arduino:sam -v | ||
arduino-cli core install arduino:mbed -v | ||
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:renesas_uno -v | ||
arduino-cli core install arduino:mbed_nano -v | ||
arduino-cli core install esp32:esp32 -v | ||
arduino-cli core install teensy:[email protected] -v | ||
arduino-cli core install Seeeduino:samd -v | ||
|
@@ -54,6 +59,7 @@ jobs: | |
arduino-cli lib install WiFiNINA | ||
arduino-cli lib install "STM32duino X-NUCLEO-IKS01A3" | ||
arduino-cli lib install "Seeed Arduino rpcWiFi" # Dependent libraries(e.g. "Seeed Arduino rpcUnified") will be installed together. See https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/#needed-libraries-for-wi-fi for more details. | ||
arduino-cli lib install WiFiEspAT | ||
# Build all demos | ||
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_addtwoints_service -v | ||
|
@@ -64,10 +70,10 @@ jobs: | |
arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_time_sync -v | ||
arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_types_handling -v | ||
# Build one demo for each platform | ||
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_decibels -v | ||
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_IMU_ML -v | ||
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_decibels -v | ||
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_IMU_ML -v | ||
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn teensy:avr:teensy31 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn teensy:avr:teensy35 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn teensy:avr:teensy36 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
|
@@ -76,8 +82,16 @@ jobs: | |
arduino-cli compile --fqbn arduino:samd:arduino_zero_native /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:sam:arduino_due_x /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
# arduino-cli compile --fqbn arduino:mbed:envie_m4 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn Seeeduino:samd:seeed_wio_terminal /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
arduino-cli compile --fqbn arduino:mbed_giga:giga /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v | ||
arduino-cli compile --fqbn arduino:mbed_giga:giga /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v | ||
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 | ||
# 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 | ||
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
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
89 changes: 89 additions & 0 deletions
89
examples/micro-ros_publisher_wifi_at/micro-ros_publisher_wifi_at.ino
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,89 @@ | ||
// To use "ESP-AT External WiFi module"(hereinafter called "ESP-AT") with your board, install "WiFiEspAT" from Library Manager. | ||
// See https://www.espressif.com/en/products/sdks/esp-at/overview for more details about ESP-AT. | ||
|
||
#define BOARD_WITH_ESP_AT | ||
// Configurations about communication between Host MCU and ESP-AT. | ||
// In most cases, you would burn ESP-AT firmware v2 or later. And you should uncomment "#define WIFIESPAT1" in EspAtDrvTypes.h | ||
// See https://github.com/JAndrassy/WiFiEspAT/tree/7f398e14f331fc845c4af671f1946fe3f29a744f#getting-started for more details. | ||
#define ESP_AT_SERIAL_PORT Serial1 // Serial port object to ESP-AT | ||
#define ESP_AT_BAUDRATE 115200 // Baudrate setting in ESP-AT firmware(default is 115200) | ||
#define ESP_AT_RESET_PIN -1 // GPIO_PIN connected to ESP-AT's reset pin(-1 means not to use hardware reset) | ||
|
||
#include <micro_ros_arduino.h> | ||
|
||
#include <wifi_transport.cpp> | ||
|
||
#include <stdio.h> | ||
#include <rcl/rcl.h> | ||
#include <rcl/error_handling.h> | ||
#include <rclc/rclc.h> | ||
#include <rclc/executor.h> | ||
|
||
#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) | ||
#define BOARD_HAS_NATIVE_WIFI | ||
#endif | ||
|
||
#if defined(BOARD_HAS_NATIVE_WIFI) | ||
#error This example is not available for boards that have native WiFi. | ||
#endif | ||
|
||
rcl_publisher_t publisher; | ||
std_msgs__msg__Int32 msg; | ||
rclc_support_t support; | ||
rcl_allocator_t allocator; | ||
rcl_node_t node; | ||
|
||
#define LED_PIN 13 | ||
|
||
#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}} | ||
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}} | ||
|
||
|
||
void error_loop(){ | ||
while(1){ | ||
digitalWrite(LED_PIN, !digitalRead(LED_PIN)); | ||
delay(100); | ||
} | ||
} | ||
|
||
void timer_callback(rcl_timer_t * timer, int64_t last_call_time) | ||
{ | ||
RCLC_UNUSED(last_call_time); | ||
if (timer != NULL) { | ||
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL)); | ||
msg.data++; | ||
} | ||
} | ||
|
||
void setup() { | ||
set_microros_wifi_transports("WIFI SSID", "WIFI PASS", "192.168.1.57", 8888); | ||
|
||
pinMode(LED_PIN, OUTPUT); | ||
digitalWrite(LED_PIN, HIGH); | ||
|
||
delay(2000); | ||
|
||
allocator = rcl_get_default_allocator(); | ||
|
||
//create init_options | ||
RCCHECK(rclc_support_init(&support, 0, NULL, &allocator)); | ||
|
||
// create node | ||
RCCHECK(rclc_node_init_default(&node, "micro_ros_arduino_wifi_node", "", &support)); | ||
|
||
// create publisher | ||
RCCHECK(rclc_publisher_init_best_effort( | ||
&publisher, | ||
&node, | ||
ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), | ||
"topic_name")); | ||
|
||
msg.data = 0; | ||
} | ||
|
||
void loop() { | ||
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL)); | ||
msg.data++; | ||
} |
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
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
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
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