- What is the action type of '/gripper_action'.
- Is it a custom action that you created? If so, it is possible to share that with us?
- Where is your action server running (os, ros-version)?
- Do you see the error only after 'delete(gripper_actClient);' ? Or any other line of above code is responsible for this issue?
- Do you see the same issue with some other action type as well?
MATLAB has encountered an internal problem after deleting the action client
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Xin Xing am 2 Nov. 2021
Kommentiert: Yongqing Li am 1 Dez. 2022
Before, I used MATLAB to define actionclient to control the actionserver in ROS. After using it, I didn’t want to disconnect from ROS so that I could continue to send goals to actionserver. Therefore, I only deleted the current actionclient, as in the following example.
[gripper_actClient, gripper_msg] = rosactionclient('/gripper_action');
gripper_msg.Type = 0;
[resultMsg, resultState] = sendGoalAndWait(gripper_actClient, gripper_msg);
However, after that, when I wanted to perform any operation in MATLAB, an error message appeared.
Connection to process with Exchange: "45b2b5d4-bb67-48e5-bf98-267b41dba48d " was lost.
I had to close matlab and restart it. When I run the above code again, it was still the same result. Has anyone encountered the same problem?
I used MATLAB R2021b in windows. I have also tried in Ubuntu 16.04 and there was same problem, but in macOS Big Sur (Version 11) not.
Karthik Reddy Vennapureddy am 12 Mai 2022
In the action server callback implementation, the Preempt logic is outside the while loop and is never reached when the goal is being cancelled. When the goal is running by the server and we send a cancelGoal request from action client to action server, due to incorrect implementation of action server callback the goal keeps running and tries to send the feedback even if the actionclient is deleted and hence the issue.
The goal will be active until we make the status of goal as preempted or aborted in the action server. In this case, this is being done outside of while loop, which makes it infinite loop. So, to avoid this error please follow one of the below solutions.
Solution 1: Move the Preempt logic into while condition as below.
//----------------------- Preempt -----------------
if(as.isPreemptRequested() || !ros::ok())
ROS_WARN("%s: Preempted", action_name.c_str());
success = false;
success = true;
ROS_INFO("\nType: %i [0 - Basic mode 1 - Pinch mode 2 - Wide mode 3 - Scissor mode] \nWidth: %i \nSpeed: %i of 255\nForce: %i of 255", goal->type, weite, gswk, kraft);
The same is recommended by ROS Community : Link.
Solution 2: Change the while condition as below:
while(as.isActive() && !as.isPreemptRequested() && ros::ok())
Weitere Antworten (0)
Find more on Publishers and Subscribers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!