Open TheHassanShahzad opened 7 months ago
Maybe you can increase the priority of the stepper task to a greater number than the micro-ROS task
Hi Pablo. I again ran into this issue in another project involving ESP NOW.
It seems that when doing tasks on another core it seems that playing with the priority level is the way to prevent the micro ros agent from deleting the session and re establishing it.
For the stepper a priority of 0 worked but for the ESP NOW I had to use 3
Not sure what is going on
Issue template
Steps to reproduce the issue
I found that i cannot drive the stepper motor within the main loop where 'RCCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)))' is being spun. Since the steppers are extremely time sensitive, a delay of a few microseconds within the loop driving the steppers can affect the speed. I decided to use the ESP32 second core to handle stepper control and the main core for micro-ros. I have a gamepad connected where the y axis of a joystick on the gamepad is inclination and the x axis is steer_vel (these values only make sense since i am making a 2 wheel balancing robot)
Here is my code that causes the steppers to spin using the joystick for about a few seconds and then the micro-ros-agent restarts again and again.
Expected behavior
The stepper should always spin when the joystick feeds it commands instead of stopping the micro ros- agent and starting again
Actual behavior
stepper motor spins for a bit then stops then spins again once micro-ros-agent restablishes connection
Additional information