Rosanswers logo

Im trying to understand ardrone_autonomy code which is the ROS driver for parrot ar drone.

Here is the github page

Particularly I am looking at the following code from this part:

void CmdVelCallback(const geometry_msgs::TwistConstPtr &msg)
  // Main 4DOF
  cmd_vel.linear.x  = std::max(std::min(-msg->linear.x, 1.0), -1.0);
  cmd_vel.linear.y  = std::max(std::min(-msg->linear.y, 1.0), -1.0);
  cmd_vel.linear.z  = std::max(std::min(msg->linear.z, 1.0), -1.0);
  cmd_vel.angular.z = std::max(std::min(-msg->angular.z, 1.0), -1.0);
  // These 2DOF just change the auto hover behaviour
  // No bound() required
  cmd_vel.angular.x = msg->angular.x;
  cmd_vel.angular.y = msg->angular.y;

1.) What are these vp_os_mutex_lock and vp_os_mutex_unlock ? I have tried to find their function definitions in the github page, but I couldn't. I have tried to googled them, but I couldn't find info about them also.

2.) According to this , if we want to fly the drone , we need to publish message to cmd_vel topic.

SO I expect the callback function (see the code above) to kinda send command to control the drone depending on the velocity input received, but I don't really understand the callback function here. What is it actually doing here?

3.) What is the data that the parrot ar drone's microcontroller expect to receive? WHat is the data type/variable name? Are they in ROS message format? Please elaborate on this

**4.) Is ROS actually installed in the ardrone microcontroller?? No right? **

5.) Similarly, what is the data that parrot ar dron's microcontroller send? I know that they send picture, sensor data, etc. My question is: Are the data format already in ROS message form? If no, please elaborate on this.

PS: According to ardrone_autonomy page : "Information received from the drone is published to the ardrone/navdata topic. The message type is ardrone_autonomy::Navdata"

But that one is published/done by the ROS Driver/ardrone_autonomy after filling the message right? WHat are the actual data received from the Drone?

6.) (Total newbie basic question. Sorry, please bear with me) ardrone_autonomy is a ROS driver for Parrot AR-Drone. So what does this ardrone_autonomy actually do? (please help me clarify things)

  • It is running in our PC
  • It establishes communication between PC and drone
  • it receives data from drone to PC
  • Those data can be used to perform some computation/algorithm in our computer to control the drone in more advanced way: e.g. navigation, obstacle avoidance, or whatever we implement
  • This computation and algorithm^ is performed in our PC, not in the drone's microcontroller. Right?
  • it sends data/command from PC to drone.

7.) I know that we can directly program in the drone's microcontroller. (Right?)

8.) Can you please help to explain where in the driver code does the conversion between the ROS data typle/message and the ARDrone data type happen?

Any help will be appreciated , Thanks!

Originally posted by alienmon on ROS Answers with karma: 582 on 2016-09-30

Post score: 0


1 Answer 1


Rosanswers logo

  1. The mutexes are straighforward mutexes which I would assume are there to prevent the cmd_vel object from being accessed when it is being updated in the callback. Normally there must be another thread which has access to cmd_vel probably for publishing to the drone.

  2. cmd_vel seems to be a variable that is in scope for both the callback and the part of the program that sends commands to the ardrone. this usually means that it is a class variable or a global variable (poor practice) -- actually it is a global variable in the file linked.

  3. Not sure on the parrot drone, but I'd expect it would be sending some type of serial message in the ardronedriver,checkout the ardrone_tool package (not in this repository)

  4. I think this is for a companion computer to the ardrone

  5. Have a look in the ardronedriver.cpp, it has a loop where information is recieved and published to the drone.

8. It appears the ardronedriver.cpp does this conversion. Though the actual comms is from a package called ardrone_tool that is not included in the repository. look at the ardrone_sdk.hpp's #include statements.

Originally posted by PeterMilani with karma: 1493 on 2016-10-02

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by alienmon on 2016-10-02:

1& 2. So now that the mutex is just for protecting the data. This callback function does not push the cmd_vel to the drone, but the callback function just updates its value of cmd_vel , and cmd_vel which is a global var is pushed by other part of code. Is that correct?

Comment by alienmon on 2016-10-02:

Could you help to find out where in the code, does this cmd_vel being pushed to the drone?

  1. My main point that I want to clarify is that : Does the ArDrone's/other robots microcon knows the ROS message format?Or our computer just sends primitive/general data type to microcon?

Comment by alienmon on 2016-10-02:

3&6. what is this ardrone_tool pkg for? I don't remember installing ardrone_tool in my laptop (I followed the installation insturction). I tried to find the pkg in my laptop but couldn't find.

  1. "It appears the ardronedriver.cpp does this conversion." ->wht conversion?

Comment by alienmon on 2016-10-02:
I read from the readme of ardrone_autonomy: "Patched ARDroneLib repository: https://github.com/AutonomyLab/ardronelib"

I checked. The ARDroneLib contains ardrone_tool.. but I never installed ARDroneLib before. So how the code that has "include ardrone_tool" could work if i don't have the file?

Comment by PeterMilani on 2016-10-02:
That should be 6. does the conversion between ROS and ARdrone. I'm not sure where the ardrone_tool headers are kept. Have you downloaded and built the code? if so I suggest looking through that to get a better understanding of what is going on.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.