How to get drone status and parameters

Hey guys,

I’ve just started using Parrot-Sphinx as a software-in-the-loop platform to test my control architecture in an environment quite close to reality. Its combination with Gazebo makes the platform so interesting, therefore I thought: why shouldn’t I use it for my research activity and release the developed software as open-source for other researchers and developers?!

To that aim, I download the Parrot-Sphinx simulator on my Linux machine (Ubuntu 16.04 with ROS Kinetic Kame) and I developed the firmware interface (Sphinx) to allow my code (it is already able to simulate and control the Parrot Bebop 2 in Gazebo) to work with command signals used as input in the Sphinx simulation platform. Unfortunately, during development, I wasn’t able to change or get drone parameters from Sphinx. As I saw in the forum pages (Change mass and inertia of bebop_2), the files used by Sphinx are encrypted. Therefore, it seems that there are no ways to get them from the environment.
Thus, as your knowledge, is there a way (even a manual apart from the online documentation would be fine) to get information (i.e., inertia, mass, etc.) used by Parrot engineers in Sphinx?

Furthermore, to close the control loop I need to know more about the drone status. I started using the bebop_autonomy ROS package but the data published on the topic “/odom” refer to estimated values. As many of you know, have estimated values without having information about noise and bias terms, making controller parameters tuning a challenge. So, my question, is there a way to get data from the data logger (tlm-data-logger function) on a ROS network? I saw some topics on the forum (Reading altitude, velocities and acceleration of Bebop 1 - #2 by ocrave), but they used system calls and other stuff.

They might be enough, but when controlling the drone with a 100Hz position control working frequency, they could be critical.

Thank you in advance for all developers and researcher will help me.

1 Like

Hello Giuseppe,

You can get model information with parrot-gz:

/opt/parrot-sphinx/usr/bin/parrot-gz model -m bebop2 -i

As for telemetry, you should be able to redirect data coming from tlm-data-logger into a ROS topic as explained here:

I have not tried it myself but, in theory, it should work. You can also enable the option -r 0 to log data at high speed.

1 Like

Thank @ocrave, I suggest also to use the command

gz model -m bebop2 -i > bebopModel.txt

to store the output of the command in a log file.

hi, you can also read the pose of the drone from gazebo.

Hi @0Jiahao! Yes, I am able to access all the drone state variables. Me and my colleagues, at the University of Sannio in Benevento, are working on Sphinx, in particular with the Parrot Bebop 2, in the development of a complete software platform to analyze the behavior assumed by the drone in an environment very close to reality (e.g., such as Gazebo), understanding and fixing, before tests in the real world, possible implementation problems and/or in the control algorithm (this is commonly tested on simplified models by using Matlab/Simulink).

You can find the code developed up to this point: https://github.com/gsilano/BebopS. While the code involving Sphinx, on which we are working is present in the branch dev/Sphinx. Please note that its features are not guaranteed.

1 Like

Awesome! I have a question about your repository, the inner controller (from command to behavior) of the simulation is bebop or rotorS?

If you take a look at the master, we have only simulated the quadrotor dynamics considering the Bebop parameters. Whereas, in the dev/Sphinx branch, the inner loop is replaced by Sphinx, so the Parrot Bebop 2 firmware. Unfortunately, the code is not yet ready for use. We are working on it, but we do not know when it will be released.

I have also make a simple simulation with sphinx as the inner controller. Currently, it is ok to me because I am working with single bebop and without extra sensors and modules. But it will be too cumbersome if later I simulate multiple drones or add some extra payload or sensors. Would it be possible to sim multiple drones with your repositories? Thanks;)

Yes, it is possible, but you should change something. I mean, the launch file and, maybe, the drone file in the Sphinx folder. I never thought of simulating more than one drone, but it would be nice to understand how to it. I will discuss with my colleagues and as soon as it is ready, I will let you know on the forum :slight_smile:

Hi@giuseppe.silano! Thanks for your helpful info. I’m also trying to read the /gazebo/default/pose/info topic. I tried

parrot-gz topic -e /gazebo/default/pose/info

and

gz topic -e /gazebo/default/pose/info

in the terminal after launching the sphinx with one drone and they returned a little bit different results.

The first one returns correct results as follows

time {
  sec: 8
  nsec: 547000000
}
pose {
  name: "Bebop1"
  id: 10
  position {
    x: -0.00033121468296625053
    y: 0.00062852123742144659
    z: 0.0048740620753592589
  }
  orientation {
    x: 1.229821080293234e-06
    y: -5.7511182328991957e-05
    z: 0.01515147281298114
    w: 0.99988520819269489
  }
}
pose {
  name: "Bebop1::body"
  id: 11
  position {
    x: 0
    y: 0
    z: 0.045
  }
  orientation {
    x: 0
    y: 0
    z: 0
    w: 1
  }
}

However, the second one returns:

time {
  sec: 81
  nsec: 419000000
}
pose {
  name: "Bebop1"
  id: 10
  position {
    y: -0.00033121468296625053
    z: 0.00062846459922576365
    4: 0x3f73f6d31365c0a0
  }
  orientation {
    x: 1.2298210802933611e-06
    y: -5.751118232899193e-05
    z: 0.01515147281298114
    w: 0.99988520819269489
  }
}
pose {
  name: "Bebop1::body"
  id: 11
  position {
    y: 0
    z: 0
    4: 0x3fa70a3d70a3d70a
  }
  orientation {
    x: 0
    y: 0
    z: 0
    w: 1
  }
}

The difference comes from the position info (the second has incorrect index [y, z, 4], instead of [x, y, z]).

I wrote a ros node to read the /gazebo/default/pose/info, but it gave me the second incorrect information. The essential part of my code includes:

my_logger.pose_gazebo_sub = node->Subscribe("/gazebo/default/pose/info", &data_logger::read_pose, &my_logger);

geometry_msgs::PoseStamped pose_temp;

// Reading Follower pose from Gazebo
void data_logger::read_pose(ConstPosesStampedPtr &msg)
{
	pose_temp.header.frame_id = "world";
	// pose_temp.header.seq = 0;
	const ::gazebo::msgs::Time &time_now = msg->time();
	pose_temp.header.stamp.sec = time_now.sec();
	pose_temp.header.stamp.nsec = time_now.nsec();

	for (int i =0; i < msg->pose_size(); ++i)
    	{
		const ::gazebo::msgs::Pose &pose_now = msg->pose(i);
		if (pose_now.name() == "Bebop1")
		{
			const ::gazebo::msgs::Vector3d &position = pose_now.position();
			const ::gazebo::msgs::Quaternion q = pose_now.orientation();

			pose_temp.pose.position.x = position.x();
			pose_temp.pose.position.y = position.y();
			pose_temp.pose.position.z = position.z();
			pose_temp.pose.orientation.w = q.w();
			pose_temp.pose.orientation.x = q.x();
			pose_temp.pose.orientation.y = q.y();
			pose_temp.pose.orientation.z = q.z();

			this->pose_pub.publish(pose_temp);
		}
	}
}

Do you also have the problem and how did you solve it?

It looks like your version of ros is not compatible with the gazebo version used by sphinx (7.0.1). It works with parrot-gz because it encapsulates /opt/parrot-sphinx/usr/bin/gz-7.0.1 but your default gz command is probably more recent and does not properly parse a data stream coming from gazebo 7.0.1.

Thanks! I think it should be the reason. Last year I used the same code with Ubuntu 16.04 + ROS Kinetic and it could read the data successfully.