ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Running two quads with hector_quadrotor_gazebo

asked 2012-09-22 12:51:09 -0500

Hello -- I'm trying to run two quads in simulation using hector_quadrotor_gazebo. I have been able to modify things such that each quad is in a seperate namespace and start at different locations. However, the /calibrate service does not get assigned to a different namespace. I end up with the following behavior:

1) I launch a world with a single quad, I'm able to control it with my gamepad through hector_quadrotor_teleop

2) I launch the second quad in the seperate namespace, and the first quad then starts up towards the sky with about 3 m/s of linear/z velocity. I get an error message in my original roslaunch terminal window:

[ERROR] [1348353951.598192355, 41.102000000]: Tried to advertise a service that is
already advertised in this node [/calibrate]

Neither quad is controllable via teleop/cmd_vel anymore.

I'm not sure if this /calibrate issue is the problem. I can't figure out which bit of code is setting up the /calibrate service. I did rosservice info on it:

sameer@ubuntu:~/rosinstall-test/here$ rosservice info /calibrate
Node: /gazebo
URI: rosrpc://ubuntu:38106
Type: std_srvs/Empty

Anyone have an idea or a direction I can go to figure out what is happening? Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-09-23 12:56:03 -0500

updated 2012-10-19 10:14:08 -0500

So it looks like the serviceName is set before topicName is set, so while perhaps the intent was for serviceName to be set to imu/calibrate (putting it in the right namespace) it is ending up as just /calibrate. I'll switch the order of these two and we'll see what happens. Thanks.

  if (!_sdf->HasElement("serviceName"))
    serviceName = topicName + "/calibrate";
    serviceName = _sdf->GetElement("serviceName")->GetValueString();

  if (!_sdf->HasElement("topicName"))
    topicName = "imu";
    topicName = _sdf->GetElement("topicName")->GetValueString();


It also turned out that the sensor code in hector_gazebo_plugins was getting confused because both robots had the same link name for their base link.. So the sensor plugins were both pointing at the same robot rather than different robots for different sensors. Johannes applied a patch this week which should fix it, so the plugin gets the link for the model that its attached to.

edit flag offensive delete link more

answered 2012-09-23 10:16:48 -0500

SL Remy gravatar image

Hi there, gazebo_ros_imu is probably the node in question as far as calibration goes.. I found the serviceName in the quadrotor directory with:

$grep -r calibrate .

That error suggests that there somehow still is a namespace collision... I would expect each robot to have it's own imu.

How do you launch the second quadrotor? Are you ensuring that it's not being spawned in the same location as the first? (this might be a reason that one "flies away")

Have you confirmed that the topics and services are really what you think they are? (rostopic/rosservice list)?

edit flag offensive delete link more


Thanks for finding the calibrate service, I'll look for the namespace collision there. Each robot does have its own imu, I'm getting imu messages from both robots published seperately to the appropriate topics within the right namespace. The 2nd quad is launched in a separate spot I am pretty sure,

sameer gravatar image sameer  ( 2012-09-23 12:50:58 -0500 )edit

I as I have modified spawn_quadrotor.launch to take x_pos, y_pos, and z_pos arguments and pass them on to spawn_robot.

sameer gravatar image sameer  ( 2012-09-23 12:52:56 -0500 )edit

Question Tools

1 follower


Asked: 2012-09-22 12:51:09 -0500

Seen: 369 times

Last updated: Oct 19 '12