Microros client stops receiving data
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- cpp, embedded-iot
调研方向
首先,使用 set_microros_wifi_transports 和不同的 UDP4 端口,通过三个 ESP32 设备复现该设置。检查传输设置和 rclc_executor_spin_some 循环,同时比较单设备和三设备的行为。完成的标准是:所有设备同时运行时仍能持续接收其订阅的数据。
由索引模型根据 Issue 内容生成。
描述
Hey @pablogs9 ,
I am facing some sort of communication issue as follows....
Problem Description:
I am facing difficulties when attempting to run three ESP32 devices simultaneously, each connecting to a MicroROS agent and publishing twist data to three separate bots. Despite having a strong WiFi signal and utilizing the UDP4 protocol on different ports for each ESP32 device (port 8888 and others), we encounter a recurring problem. Initially, when each ESP32 device is started individually, communication runs smoothly. However, after a short period, all three ESP32 devices cease to receive data.
Key Details:
- WiFi Signal Strength: Strong
- Protocol: UDP4
- Port Configuration: Each ESP32 device uses a unique port for communication
Efforts Made:
- Ensured strong WiFi signal.
- Configured each ESP32 device to use a unique port for communication.
- Verified that communication functions correctly when bots are started individually.
Code on each ESP32(changing the node and topic names as well as ports accordingly):
#include <ESP32Servo.h>
#include <micro_ros_arduino.h>
#include <stdio.h>
#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <geometry_msgs/msg/twist.h>
#include <std_msgs/msg/bool.h> // Include Bool message type
rcl_subscription_t subscriber_cmd_vel;
geometry_msgs__msg__Twist msg;
rcl_subscription_t subscriber_pen_down;
std_msgs__msg__Bool pen_msg;
rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo_pen;
#define servo1_pin 25
#define servo2_pin 26
#define servo3_pin 27
#define servo_pen_pin 19
#define LED_PIN LED_BUILTIN
#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 cmd_vel_callback(const void * msgin)
{
const geometry_msgs__msg__Twist * msg = (const geometry_msgs__msg__Twist *)msgin;
// Your processing logic for Twist messages goes here
}
void pen_down_callback(const void * msgin)
{
const std_msgs__msg__Bool * pen_msg = (const std_msgs__msg__Bool *)msgin;
// Your processing logic for Bool messages goes here
}
void setup() {
set_microros_wifi_transports("wifi", "password", "192.168..", 8888);
// set_microros_tcp_transports("192.168.65.44", 8892);
Serial.begin(9600);
servo1.attach(servo1_pin);
servo2.attach(servo2_pin);
servo3.attach(servo3_pin);
servo_pen.attach(servo_pen_pin);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);
delay(2000);
allocator = rcl_get_default_allocator();
RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));
RCCHECK(rclc_node_init_default(&node, "subscriber_node_3", "", &support));
RCCHECK(rclc_subscription_init_default(
&subscriber_cmd_vel,
&node,
ROSIDL_GET_MSG_TYPE_SUPPORT(geometry_msgs, msg, Twist),
"/cmd_vel/bot3"));
RCCHECK(rclc_subscription_init_default(
&subscriber_pen_down,
&node,
ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Bool),
"/pen3_down"));
RCCHECK(rclc_executor_init(&executor, &support.context, 2, &allocator));
RCCHECK(rclc_executor_add_subscription(&executor, &subscriber_cmd_vel, &msg, &cmd_vel_callback, ON_NEW_DATA));
RCCHECK(rclc_executor_add_subscription(&executor, &subscriber_pen_down, &pen_msg, &pen_down_callback, ON_NEW_DATA));
}
void loop() {
RCCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(1)));
servo1.write(msg.linear.x + 90);
servo2.write(msg.linear.y + 90);
servo3.write(msg.linear.z + 90);
// Process msg_pen_down (bool) if needed
if (pen_msg.data) {
servo_pen.write(95);
} else {
servo_pen.write(90);
}
}
- 主要语言
- Shell
- 星标
- 514
- 派生
- 184
- 平均合并
- 22 小时 26 分钟
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
micro-ROS/micro_ros_setup 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
micro-ROS/micro_ros_setup#837 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 68/100
micro-ROS/micro_ros_setup#814 ·
-
难度 4/5 3-5 天 新手友好度 42/100
micro-ROS/micro_ros_setup#809 ·
-
难度 4/5 3-5 天 新手友好度 38/100
micro-ROS/micro_ros_setup#808 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
micro-ROS/micro_ros_setup#806 ·
查看 micro-ROS/micro_ros_setup 的全部 Issue
相似的 Issue
-
docs: tutorial 7 still references removed A2AStarletteApplication可能已有人在做 @FOWEPJF255 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
a2aproject/A2A#2321 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
OpenSlides/OpenSlides#7180 ·
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
good first issue needs-triage priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
melodic-software/claude-code-plugins#6499 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
buildkite/elastic-ci-stack-for-aws#1905 ·
维护者通常 1 天内回复