Open Latek opened 1 month ago
Since you are using micro-ros serial transport, you cannot use serial printf at the same time. You should comment out the printf.
We are using the default fast dds. There is no need to set the RMW_IMPLEMENTATION. And rmw_microxrcedds should not be used with arduino.
Have you tried the int32 publisher? You should start with the simple one.
You may follow my wiki. https://github.com/hippo5329/micro_ros_arduino_examples_platformio/wiki
Thank you for your response.
Since you are using micro-ros serial transport, you cannot use serial printf at the same time. You should comment out the printf.
You're 100% right! My mistake!
We are using the default fast dds. There is no need to set the RMW_IMPLEMENTATION. And rmw_microxrcedds should not be used with arduino.
Have you tried the int32 publisher? You should start with the simple one.
Int32 publisher works as expected. When I removed printf calls my ping-pong example still doesn't work and I got the same error: "realloc(): invalid pointer [ros2run]: Aborted". Sometimes the ping is sent before the error, sometimes not.
I've also tried the micro-ros_addtwoints_service example where the agent seems to connect to due, but the ros2 service caller waits endlessly for the service to be available.
Is the Serial transport method not designed to be used in all cases/examples? Do you think the problem is with using Arduino DUE?
I have built the robot based on the Ardumower (https://wiki.ardumower.de/) for which I'd like to rewrite the program using ROS2 + micro-ROS. The PCB 1.4 is compatible with Arduino DUE, Mega, or Adafruit Grand Central M4 Express.
arduino due $50 single core 84Mhz 512K flash 96K sram, Arm will stop mbed support soon. esp32 $5 dual core 240MHnz 4M flash 512k sram wifi on chip, well supported freertos/arduino/micro-ros
due has very small flash and sram. it has to use the low memory colcon meta. due has very limited capability for micro-ros. You should really switch to esp32.
Issue template
Steps to reproduce the issue
include <rcl/rcl.h>
include <rcl/error_handling.h>
include <rclc/rclc.h>
include <rclc/executor.h>
include <std_msgs/msg/header.h>
include
include
include "clock_gettime.h"
define STRING_BUFFER_LEN 100
define LED_PIN 13
define RCCHECK(fn) \
define RCSOFTCHECK(fn) \
void error_loop() { while (1) { digitalWrite(LED_PIN, !digitalRead(LED_PIN)); delay(100); } }
rclc_executor_t executor; rcl_publisher_t ping_publisher; rcl_publisher_t pong_publisher; rcl_subscription_t ping_subscriber; rcl_subscription_t pong_subscriber;
std_msgsmsgHeader incoming_ping; std_msgsmsgHeader outcoming_ping; std_msgsmsgHeader incoming_pong;
int device_id; int seq_no; int pong_count;
void ping_timer_callback(rcl_timer_t *timer, int64_t last_call_time) { (void)last_call_time;
}
void ping_subscription_callback(const void msgin) { const std_msgsmsgHeader msg = (const std_msgsmsgHeader *)msgin;
}
void pong_subscription_callback(const void msgin) { const std_msgsmsgHeader msg = (const std_msgsmsgHeader *)msgin;
}
void setup() { set_microros_transports();
}
void loop() { delay(100); RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100))); }
include
include <sys/time.h>
define micro_rollover_useconds 4294967295
ifndef _POSIX_TIMERS
extern "C" int clock_gettime(clockid_t unused, struct timespec *tp) { (void)unused; static uint32_t rollover = 0; static uint32_t last_measure = 0;
}
endif // ifndef _POSIX_TIMERS
xport ROS_DISTRO=humble source /opt/ros/$ROS_DISTRO/setup.bash source install/local_setup.bash ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0
export ROS_DISTRO=humble source /opt/ros/$ROS_DISTRO/setup.bash source install/local_setup.bash ros2 topic list
/microROS/ping /microROS/pong /parameter_events /rosout
export RMW_IMPLEMENTATION=rmw_microxrcedds ros2 run micro_ros_demos ping_pong
[ERROR] [1722378449.432044514] [rclc]: [rclc_init] Error in rcl_init: error not set, at ./ erc/rcl/init.c:218
Failed status on line 82: 1 Aborting. ros2run: Process exited with failure 1
export RMW_IMPLEMENTATION= ros2 run micro_ros_demos ping_pong
[INFO] [1722378409.760130758] [] Created a timer with period 2000mc.
Ping send seq 846930886_1804289383 realloc(): invalid pointer