0
$\begingroup$

Rosanswers logo

Hi guys, I have been working on the ar.drone flying robot and what I want is to have the ar.drone takeoff, change the yaw angle by 90 degrees while holding that hover position and then land. I tried to write some code to achieve this but what happens is the ar.drone keeps on spinning all throughout the take off and landing. Here is my method:

void DC::Yaw(){
    ros::NodeHandle nh;
    ros::Publisher flyF = nh.advertise<geometry_msgs::Twist>("/cmd_vel", 1000, true);
    geometry_msgs::Twist yaw;
 
    yaw.angular.x =0;
    yaw.angular.y = 0;
    yaw.angular.z = 1.57;

    flyF.publish(yaw);
    ros::Duration(1).sleep();  
}

My takeoff and land functions work well but it is just this yaw function that is causing me issues.

Thanks!


Originally posted by MichaelJ on ROS Answers with karma: 15 on 2013-10-11

Post score: 0


Original comments

Comment by dornhege on 2013-10-12:
What if you publish zero velocity after that 1 second?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Try resetting the linear velocities to zeros when you want to hover?


Originally posted by espee with karma: 81 on 2013-10-12

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by MichaelJ on 2013-10-12:
Should I also set the yaw.angular.z back to zero?

Comment by espee on 2013-10-12:
if you just want a takeoff, rotation and land, your twist sequence should look sth like [0 0 1 0 0 0] (1m/s z-direction) [0 0 0 0 0 1] (1 rad/s along z-axis) [0 0 -1 0 0 0] (-1m/s z-direction) and finally [0 0 0 0 0 0].

$\endgroup$

Your Answer

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