code is getting stuck while getting model state from gazebo

asked 2020-08-22 11:56:08 -0500

Karthik Rajkumar gravatar image

updated 2020-08-22 16:36:24 -0500

jayess gravatar image

I am running a reinforcement learning-based model using ros and gazebo. My total number of episodes are 10,000. But around 50 to 100th episodes, I am not able to get the position of my robot.

client = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState)
model_state = client('model_name','world')

I am running in windows subsystem (Ubuntu) Ros Melodic Gazebo 9x

It got stuck and not proceeding further. Kindly help me in this regard.

edit retag flag offensive close merge delete


Have you tried this in a native enviroment? Furthermore, what info do you want from the model state? You may want to obtain that from a topic instead of requesting a service every new cycle.

Weasfas gravatar image Weasfas  ( 2020-08-25 04:30:33 -0500 )edit

I just took a AWS Ubuntu instance and it seems to work without any hassle, but in WSL 1 it gets stuck

Karthik Rajkumar gravatar image Karthik Rajkumar  ( 2020-08-25 09:25:23 -0500 )edit

I am getting the orientation and the position of the robot from the model state

Karthik Rajkumar gravatar image Karthik Rajkumar  ( 2020-08-25 09:25:55 -0500 )edit

Well, you can try to get that information by subscribing to the model odometry and test if it is a problem of the several service calls or the enviroment performace. I have never tried to work over WSL since it is tagged as an experimental platform, that may be the reason why there are certain things that do not work as intended.

Weasfas gravatar image Weasfas  ( 2020-08-26 04:10:08 -0500 )edit

Yes Weasfas, you are correct, even subscribing to the model odometry also fails at some point of time, I have spun a ubuntu machine and it works like a charm.

Karthik Rajkumar gravatar image Karthik Rajkumar  ( 2020-09-04 06:16:53 -0500 )edit