Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flat Trim #18

Closed
devmax opened this issue Oct 18, 2012 · 11 comments
Closed

Flat Trim #18

devmax opened this issue Oct 18, 2012 · 11 comments

Comments

@devmax
Copy link

devmax commented Oct 18, 2012

I noticed that doing a flat trim before every take-off sometimes drastically improves the accuracy of the sonar data(as it is now calibrated to zero) and leads to more stable take-offs...Unfortunately I don't have the time now to figure out how pull requests work, so please consider adding this code to enable flat trims!

in ardrone_driver.cpp add

flatTrim_sub = node_handle.subscribe("ardrone/flatTrim",1,&flatTrimCallback);

in ardrone_driver.h add

ros::Subscriber flatTrim_sub;

in `teleop_twist.cpp` add

void flatTrimCallback(const std_msgs::Empty &msg)
{
    vp_os_mutex_lock(&twist_lock);
    ROS_INFO("Setting flat trim now!");
    ardrone_at_set_flat_trim();
    ROS_INFO("Flat trim Set!");
    vp_os_mutex_unlock(&twist_lock);
}

user then publishes empty message to 'ardrone/flatTrim' topic to do a flat trim!

@mmyself
Copy link

mmyself commented Oct 18, 2012

sounds good to me.

@mani-monaj
Copy link
Member

Thanks for the code @devmax .

My previous attempts to use flat-trim was not successful. Once I put a printf in the actual function in ARDroneLib to see if it catches and executes flat-trim. I noticed that the printf seemed to get executed when the program exits. I did not go further, so I want to ask if you are completely sure that the command gets executed and has an effect?

@devmax
Copy link
Author

devmax commented Oct 19, 2012

Hi Mani,

I didn't actually do the printf test like you, but what I did was to do a flat trim while echo-ing the navdata from the drone. In the landed state the altitude is automatically zero, but the rotXYZ values seem to be reset everytime I gave the command. More concretely, I did a flat trim a couple of times while the drone was in the air, and it crashed as expected..So there is something definitely going on!

The other ARDrone tool commands (set_ui_pad and set_Progressive_cmd) seem to work fine, so I see no reason why this shouldn't!

@mani-monaj
Copy link
Member

I didn't actually do the printf test like you, but what I did was to do a flat trim while echo-ing the navdata from the drone. In the landed state the altitude is automatically zero, but the rotXYZ values seem to be reset everytime I gave the command. More concretely, I did a flat trim a couple of times while the drone was in the air, and it crashed as expected..So there is something definitely going on!

That's the correct way to testing of course.

@devmax
Copy link
Author

devmax commented Oct 22, 2012

@mani-monaj did you put the printf commands in ardrone_at_mutex.c? I did that and they didn't get executed..however even when i put the print commands in ardrone_at_set_ui_pad_value, they didn't get executed, although of course the drone takes off and lands just fine..any idea what the problem could be? I'm not very well versed with mutexes!

@mani-monaj
Copy link
Member

@devmax I think the whole idea of putting printf in ARDroneLib's low level functions is wrong and misleading. However I have no explanation about the reason 😔

@devmax
Copy link
Author

devmax commented Oct 23, 2012

@mani-monaj I agree...but you said that's the correct way of testing it...what did you mean then?

@mani-monaj
Copy link
Member

I meant the method that you used which tested the functionality rather than execution. Sorry for being vague.

@devmax
Copy link
Author

devmax commented Oct 23, 2012

oh I see, in that case do you want to commit the changes?

@mani-monaj
Copy link
Member

oh I see, in that case do you want to commit the changes?

Sure. As soon as I can.

@mani-monaj
Copy link
Member

Thanks for the contribution.

Note: flattrim has been implemented as a service.

garyservin pushed a commit to garyservin/ardrone_autonomy that referenced this issue Sep 15, 2014
Add sonar and pressure sensor publishers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants