Work with ardrone3.Piloting.PCMD

Hi, I’m working with a research project to control the drone(mainly indoors) with ROS. My goal is to keep the drone moving forward all the time, and I sent the “RIse” “Descend” “Turn left” “Turn right” commands to the drone. I am trying to use the olympe.messages.ardrone3.Piloting.PCMD command to achieve my goal.

My problems are:

  1. What is the mechanism of PCMD command. I cannot understand the describtion " The libARController is sending the command each 50ms. Please note that you should call setPilotingPCMD and not sendPilotingPCMD because the libARController is handling the periodicity and the buffer on which it is sent."

  2. What does the " timestampAndSeqNum" mean? How can I deal with that “Command timestamp in milliseconds (low 24 bits) + command sequence number (high 8 bits) [0;255].”

  3. How can I keep the drone moving forward all the time? Is PCMD the recommended way.

Thank you for your help/suggestions in advance. :grinning:

Hi,

The ardrone3.Piloting.PCMD command, which stands for P iloting C o M man D , is the user joystick command message that you can use to control your drone. Like any other command message (TakeOff, Landing, …) you can send it manually (one command message at time).

This command is a bit particular because the drone firmware only takes into account the last received piloting command if the last command is recent enough. If you loose the connection with the drone while holding the controller joysticks, the drone will stop in a few milliseconds after the disconnection. Hence, when you’re actively piloting the drone you want to send this PCMD message to the drone periodically.

You can either send the PCMD command manually in a loop or you can let Olympe do it for you in a background thread with the olympe.Drone.start_piloting, olympe.Drone.piloting_pcmd and olympe.Drone.stop_piloting functions. olympe.Drone.piloting_pcmd takes an additional piloting_time parameter that tell Olympe to apply the piloting command periodically during this period of time.

The timestampAndSeqNum parameter is should be set to 0 (its value is only useful for debugging purpose).

Note: the start_piloting, stop_piloting functions which kind of start/stop this piloting background thread might get deprecated in a future release so that you’ll be able to call olympe.Drone.piloting_pcmd without calling start_piloting first.

2 Likes

Thanks a lot. I have tried the command in the SPHINX. Plus, I want to know the duration of one command. For example, I send the PCMD command with yaw value to make the drone turn left. The document tell me that yaw is expressed as signed percentage of the max yaw rotation speed setting, in range [-100, 100]. I know the speed, but I don’t know the duration when I send one command.