Reading altitude, velocities and acceleration of Bebop 1

Operating System: Ubuntu 16.04
Version: ROS Kinetic
Tools: Sphinx, Bebop_autonomy and Eclipse C ++
Model used in the simulation: Bebop 1

Hi, I use Sphinx and Bebop_autonomy on the same machine, but I can not read the altitude, velocity, and acceleration of Bebop 1 in C ++. That way, can anyone help me do this reading using a code in c++?

Hello,

You can get this information via the “Omniscient” telemetry section using the tlm-data-logger tool. For instance:

tlm-data-logger inet:127.0.0.1:9060 | grep worldLinearVelocity

In C++, you would have to execute system commands like so:

system ("tlm-data-logger inet:127.0.0.1:9060 | grep worldLinearVelocity");

and parse the result.

1 Like

Thank you very much,
its orientation allowed to see the information regarding height, speed and acceleration, however I have not been able to store the values in variables of type double, here is my code in c++:

 "(...)
  erro = altura_desejada - altura_atual;  //calculate error in height

  while(abs(erro)>0.2){
        	  if(erro<0)
                   		  mensagem_cmd_vel.linear.z = -1;
              else
                          mensagem_cmd_vel.linear.z = 1;

              cmd_vel_pub.publish(mensagem_cmd_vel);
              ros::Duration(0.3).sleep();
              altura_atual = system("tlm-data-logger inet:127.0.0.1:9060 | grep omniscient_bebop.worldPosition.z");
              system("tlm-data-logger inet:127.0.0.1:9060 | kill omniscient_bebop.worldPosition.z");
              erro = altura_desejada - altura_atual;
 } 
 (...)"

Any suggestions on how to implement the passing of this information to the code variables? Other thing, the values that are being supplied by the command you teach are in the International System of Units, ie, meters, meters / s, meters / s2? The initial goal is to implement a PID-type altitude controller. Thanks again for the attention :slight_smile:

Omniscient uses SI units for everything.
To retrieve the result of tlm-data-logger, I would recommend using popen instead of system:

__gnu_cxx::stdio_filebuf<char> filebuf(fileno(popen(cmd, "r")), std::ios::in);
std::istream is(&filebuf);
if (is)
{
  std::string line;
  if (std::getline(is, line))
    std::cout << line << std::endl;
}

Thank you so much again

I did exactly as directed and it worked perfectly.