Home | Tutorials | Wiki | Issues
Ask Your Question
1

gazebo::common::Exception when running Gazebo as a library

asked 2014-11-19 17:24:41 -0500

NickDP gravatar image

I am trying to run Gazebo as a library using the command

gazebo::setupClient(_argc, _argv);

and loading a world using

gazebo::physics::WorldPtr world = gazebo::loadWorld("worlds/empty.world");

I.e. I want to do what the example custom_main does.

However, when I compile and run this example (after running gazebo in a separate terminal), I get the following run-time error:

terminate called after throwing an instance of 'gazebo::common::Exception'
Aborted (core dumped)

gazebo::setupClient(_argc, _argv); returns true, but gazebo::physics::WorldPtr world == NULL. This is the case no matter the content of the string that I give to gazebo::loadWorld(). Looking at the source, I would expect to see some error messages in the console (or is that not where gzerr prints to?), but I don't, even if the string does not name a world file that exists.

What am I doing wrong?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-11-20 14:53:42 -0500

nkoenig gravatar image

You need to use gazebo::setupServer, not gazebo::setupClient. A server loads world, runs phyiscs, generates sensors data, etc. A client connects to a server. The gazebo GUI is an example of a client.

edit flag offensive delete link more

Comments

I see. Now it works, thanks a lot. So if I want to write a main() that manipulates the robot models without using messages, the correct way of doing it is to call gazebo::setupServer() in my main() and then load my world/models thereafter. And then I do gzclient in a terminal?

NickDP gravatar imageNickDP ( 2014-11-20 15:20:00 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2014-11-19 17:24:41 -0500

Seen: 1,070 times

Last updated: Nov 20 '14