ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to change the yaw angle in ROS

asked 2013-10-11 15:26:38 -0500

MichaelJ gravatar image

updated 2013-10-11 22:48:09 -0500

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!

edit retag flag offensive close merge delete

Comments

What if you publish zero velocity after that 1 second?

dornhege gravatar image dornhege  ( 2013-10-12 03:11:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-10-12 05:00:02 -0500

espee gravatar image

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

edit flag offensive delete link more

Comments

Should I also set the yaw.angular.z back to zero?

MichaelJ gravatar image MichaelJ  ( 2013-10-12 05:22:33 -0500 )edit

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].

espee gravatar image espee  ( 2013-10-12 17:26:09 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-10-11 15:26:38 -0500

Seen: 1,198 times

Last updated: Oct 12 '13