Ask Your Question
0

Understanding the overview of ROS driver for Parrot Drone, and a particular code

asked 2016-09-30 02:14:36 -0600

alienmon gravatar image

updated 2016-09-30 03:22:41 -0600

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)
{
  vp_os_mutex_lock(&twist_lock);
  // 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;
  vp_os_mutex_unlock(&twist_lock);
}

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!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-10-02 08:35:36 -0600

updated 2016-10-02 20:19:20 -0600

  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.

edit flag offensive delete link more

Comments

@PeterMilani

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?

alienmon gravatar imagealienmon ( 2016-10-02 11:49:13 -0600 )edit

@PeterMilani

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?
alienmon gravatar imagealienmon ( 2016-10-02 11:54:10 -0600 )edit

@PeterMilani

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?
alienmon gravatar imagealienmon ( 2016-10-02 12:08:58 -0600 )edit

I read from the readme of ardrone_autonomy: "Patched ARDroneLib repository: https://github.com/AutonomyLab/ardron...

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?

alienmon gravatar imagealienmon ( 2016-10-02 12:17:42 -0600 )edit

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.

PeterMilani gravatar imagePeterMilani ( 2016-10-02 20:20:47 -0600 )edit
0

answered 2017-05-12 09:41:59 -0600

  1. cmd_vel topic is subscribed by node_handle in ardrone_driver.cpp. But I did not figure out how does it be sent to drone.
  2. The data sent by drone is navdata_raw in ardrone_driver.cpp and arranged to legacynavdata and publish as /ardrone/nav topic. These published topic are for users and won't go back to drone because drone has known these data.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-09-30 02:14:36 -0600

Seen: 353 times

Last updated: Oct 02 '16