Closed Muthukumar4796 closed 8 months ago
Your micro-ROS client is not connected to the micro-ROS Agent, have you reset the board after connecting?
Yes.I reset the board. but still not connect micro_ros agent.
Could you check if your board is sending any data via the serial port? Maybe using minicom or miniterm instead of the agent?
No, the board is not sending any data via serial.I'm not sure about using miniterm or minicom. I have only used Agent for my entire project. I am stuck while isolating the micro ROS topics.I have been facing this issue for the past three weeks.
I have found a solution to the problem of isolating the topic. In the code provided, the necessary lines were not included. I have added the following lines to the code to fix the issue:
// Initialize rclc support object with custom options
rclc_support_t support;
rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator);
Please take a look at this updated code.
rcl_publisher_t publisher; std_msgsmsgInt32 msg; rclc_executor_t executor; rclc_support_t support; rcl_allocator_t allocator; rcl_node_t node; rcl_timer_t timer;
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_transports();
pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH);
delay(2000);
allocator = rcl_get_default_allocator();
// Initialize micro-ROS allocator rcl_allocator_t allocator = rcl_get_default_allocator();
// Initialize and modify options (Set DOMAIN ID to 7) rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); rcl_init_options_init(&init_options, allocator); rcl_init_options_set_domain_id(&init_options, 7);
// Initialize rclc support object with custom options rclc_support_t support; rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator);
// create node RCCHECK(rclc_node_init_default(&node, "micro_ros_arduino_node", "", &support));
// create publisher RCCHECK(rclc_publisher_init_default( &publisher, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_arduino_node_publisher"));
// create timer, const unsigned int timer_timeout = 1000; RCCHECK(rclc_timer_init_default( &timer, &support, RCL_MS_TO_NS(timer_timeout), timer_callback));
// create executor RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator)); RCCHECK(rclc_executor_add_timer(&executor, &timer));
msg.data = 0; }
void loop() { delay(100); RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100))); }
--here is the updated micro ros publisher code for isolating topics using Domain_ID.Thanks for the support
Issue template
Steps to reproduce the issue
I am having difficulty isolating Micro-ROS topics without affecting the ROS domain ID specified in the bashrc file. Even after configuring the ROS domain ID within the Micro-ROS code, the topics do not appearing.
Additionally, when I try to check your Micro-ROS code, the Micro-ROS agent is also not running. https://github.com/micro-ROS/micro-ROS-demos/blob/70f3cbf27ce12dc9e57e5095b4233553e207d866/rclc/configuration_example/configured_publisher/main.c
I shared the link to your code and sent a screenshot of the Micro ROS agent not functioning.