Using position control - clems4ever/ardrone_loclib GitHub Wiki
The package ardrone_moves implements a solution for controlling the drone position. It needs a position estimation of the drone and a near target (reachable with a straight trajectory).
we developed simple GUI to help you use this tool. See Using the position control GUI
Important: the controller needs to know the drone orientation to North. The ardrone_autonomy driver does not handles magnetometer yet, so it is important to have an estimation of it. We use the orientation from drone IMU, but it only depends on the drone initial position. So you have to start the drone facing the North. It's an important inconvenient but we have to do things that way for now.
Node position_controller
This is the core of ardrone_moves, it calculates a command for the drone from the drone position and the target. The trajectory of the drone is linear (almost) between this 2 points.
Position Reference
As the controller works only on differences between target and estimated position, the reference of this positions are not used, until this two poses have the same reference. (this is NOT checked)
Yaw (orientation) control
The orientation of the drone is given by an angle. The desired orientation can be given in an absolute value (i.e. angle to north, or from initial orientation...) or it can be relative to the direction. i.e. if we want the drone to fly forward, we enable this feature and set the desired yaw to 0, to fly backward, we set it to pi...
This feature can be enabled thanks to a ROS service (see bellow).
Subscribed topics
- position_target (geometry_msgs/Pose)
the target to reach for the drone. Only the term Z for orientation is used and is interpreted as the desired yaw for the drone. - pose_estimation (geometry_msgs/PoseWithCovarianceStamped Message)
an estimation of the drone position. Covariance is not used. - trajectory_plan (ardrone_trajectory/ARDroneTrajectory) a trajectory to follow for the controller. It's a list of successive points the drone have to pass (first target is first element)
Published topics
- /cmd_vel (geometry_msgs/Twist)
the speeds for the drone, as specified by ardrone_autonomy driver, each term is normalized between -1 and 1. Hover mode is enabled.
Parameters
- distance_threshold (double, default=1) the minimal distance between target and position to consider the target is reached (used when a trajectory is given and when get_state service is called)
Services
- enable (ardrone_moves/SwitchOnOff)
Enables or disable (pause, unpause) the controller. When disabled, no output is given, no computation is made. It continues to listen to target and position. - enable_relative_yaw (ardrone_moves/SwitchOnOff)
Enable or disable the relative yaw mode. - get_state (ardrone_moves/ControllerState) Returns information on controller current state
###Use
When receiving a target on /position_target
, any previously given trajectory on /trajectory_plan
is forgotten.
Node position_controller_tf
As the position_controller but listen a tf intsead of a pose message
Results and performances
TODO