ros_qtc_plugin icon indicating copy to clipboard operation
ros_qtc_plugin copied to clipboard

Use action communication mechanism in this plugin

Open 54onePiece opened this issue 4 years ago • 9 comments

I use the action communication mechanism. After connecting to the master node, the program runs to ".waitForServer();" and the program dies. May I ask how is this going?

54onePiece avatar Oct 15 '20 06:10 54onePiece

Sorry, I am not understanding the question. Could you provide more information?

Levi-Armstrong avatar Oct 15 '20 13:10 Levi-Armstrong

Sorry, I am not understanding the question. Could you provide more information?

I use ros_qtc_plugin to develop a program, and I need to use the action mechanism in ROS to communicate with another development program. When I was developing, a program "client.waitForServer();" in the client of the action communication mechanism failed to run. During my test, the program would freeze every time I reached this sentence. Do you have any suggestions? Or can you provide me with an example that can run in ros_qtc_plugin and use the action communication mechanism. Thanks a lot

54onePiece avatar Oct 15 '20 13:10 54onePiece

Ah, so it stops there and never returns because most likely another node has not advertise the action you are waiting on. Bellow is a tutorial on setting up a simple action server and also has one for the client side.

http://wiki.ros.org/actionlib_tutorials/Tutorials/SimpleActionServer%28ExecuteCallbackMethod%29

Levi-Armstrong avatar Oct 15 '20 13:10 Levi-Armstrong

Ah, so it stops there and never returns because most likely another node has not advertise the action you are waiting on. Bellow is a tutorial on setting up a simple action server and also has one for the client side.

http://wiki.ros.org/actionlib_tutorials/Tutorials/SimpleActionServer%28ExecuteCallbackMethod%29

I built the server and tested it, and it didn't reflect much. And this is not the problem of inability to connect, but the sentence that the program will crash after running, and any button clicked will become invalid.

54onePiece avatar Oct 15 '20 13:10 54onePiece

Is this in the main GUI thread?

Levi-Armstrong avatar Oct 15 '20 13:10 Levi-Armstrong

If so, that is not good because it will freeze the application. I recommend creating an event loop were inside this it checks if a connection is available but not wait. Once the connection is available then enable aspects of the GUI.

Levi-Armstrong avatar Oct 15 '20 15:10 Levi-Armstrong

OK,I will try it. Thank you so much!

54onePiece avatar Oct 16 '20 00:10 54onePiece

If so, that is not good because it will freeze the application. I recommend creating an event loop were inside this it checks if a connection is available but not wait. Once the connection is available then enable aspects of the GUI.

I created a new thread to make ros::spinnce run continuously, but the program still has that problem.

54onePiece avatar Oct 19 '20 05:10 54onePiece

If so, that is not good because it will freeze the application. I recommend creating an event loop were inside this it checks if a connection is available but not wait. Once the connection is available then enable aspects of the GUI.

I will waitForServer return value output "Bool connected = cc_client.waitForServer(ros::Duration(5)); qDebug()<<"connected result: "<<connected;" The output is: connected result: false

54onePiece avatar Oct 19 '20 05:10 54onePiece