Gazebo | Ignition | Community
Ask Your Question
0

Cannot spawnModel from MATLAB

asked 2018-10-15 03:02:04 -0600

jwchang gravatar image

I want to do connection between MATLAB and Gazebo and generate Gazebo model from MATLAB. I follow the instruction in add-build-and-remove-objects-in-gazebo, and the following commands work successfully.

rosinit(ipaddress)
gazebo = ExampleHelperGazeboCommunicator;
ball = ExampleHelperGazeboModel('Ball') 
spherelink = addLink(ball,'sphere',1,'color',[0 0 1 1])

But when I run the next command spawnModel(gazebo,ball,[8.5,0,1]), the errors show up in MATLAB command window:

Error using ExampleHelperGazeboCommunicator/startModelServices (line 334)
Failed to create a /gazebo/get_model_state service client.

Error in ExampleHelperGazeboCommunicator/spawnModel (line 290)
            startModelServices(obj);

[ERROR] ServiceClientHandshakeHandler - Service client handshake failed: client wants service 
/gazebo/get_model_state to have md5sum af0f702011820738976b120226dc9d96, but it has 
4c515e936d3319c9610c559c60bfc3d4. Dropping connection.

The error shown in ubuntu terminal is

[ERROR] ServiceClientHandshakeHandler - Service client handshake failed: client wants service 
/gazebo/get_model_state to have md5sum af0f702011820738976b120226dc9d96, but it has 
4c515e936d3319c9610c559c60bfc3d4. Dropping connection.

I use matlab 2018b, Robotics System Toolbox2.1 on win10, and Ubuntu18.04, ROS melodic, gazebo9 in virtualbox, which are all newest version. Does anyone know how to solve it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-23 05:31:33 -0600

jwchang gravatar image

Solution is here Update MATLAB's ROS Messages

Update rosjava_messages.jar and then spawn models successfully.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-10-15 03:02:04 -0600

Seen: 876 times

Last updated: Oct 23 '18