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

Get Multicopter velocity control to work with the crazyflie model #6

Open
knmcguire opened this issue Mar 14, 2022 · 3 comments · May be fixed by #59
Open

Get Multicopter velocity control to work with the crazyflie model #6

knmcguire opened this issue Mar 14, 2022 · 3 comments · May be fixed by #59

Comments

@knmcguire
Copy link
Member

The multi copter velocity control in gazebo could also control the crazyflie, but it needs the right drag and thrust constants and the right gains.

@knmcguire
Copy link
Member Author

@mhl787156
Copy link

Hi @knmcguire I've just started using the aerostack2 crazyflie sim stack for a project I'm working on!
I've managed to get their model to takeoff (gazebo topics updated)! But the multicopter-velocity-control plugin is just not working:

      <plugin
        filename="ignition-gazebo-multicopter-control-system"
        name="ignition::gazebo::systems::MulticopterVelocityControl">
        <robotNamespace>model/{{ namespace }}</robotNamespace>
        <commandSubTopic>cmd_vel</commandSubTopic>
        <motorControlPubTopic>command/motor_speed</motorControlPubTopic>
        <enableSubTopic>velocity_controller/enable</enableSubTopic>
        <comLinkName>base_link</comLinkName>
        <velocityGain>1000 1000 5000</velocityGain>
        <attitudeGain>0.5 0.5 0.5</attitudeGain>
        <angularRateGain>1.5 1.5 1.5</angularRateGain> 

        <rotorConfiguration>
          <rotor>
            <jointName>crazyflie/m1_joint</jointName>
            <forceConstant>1.28192e-08</forceConstant>
            <momentConstant>0.005964552</momentConstant>
            <direction>1</direction>
          </rotor>
          <rotor>
            <jointName>crazyflie/m2_joint</jointName>
            <forceConstant>1.28192e-08</forceConstant>
            <momentConstant>0.005964552</momentConstant>
            <direction>-1</direction>
          </rotor>
          <rotor>
            <jointName>crazyflie/m3_joint</jointName>
            <forceConstant>1.28192e-08</forceConstant>
            <momentConstant>0.005964552</momentConstant>
            <direction>1</direction>
          </rotor>
          <rotor>
            <jointName>crazyflie/m4_joint</jointName>
            <forceConstant>1.28192e-08</forceConstant>
            <momentConstant>0.005964552</momentConstant>
            <direction>-1</direction>
          </rotor>
        </rotorConfiguration>
      </plugin>

I think they copied a model from this repo about a year/two years ago. No idea if the drag, thrusts, force or moment constants are correct, and I have no idea where the gains come from.

You can see a plotjuggler picture of the current controller here.

Wondering if you had any suggestions on how I might be able to tune the thing? I've spent a day semi-randomly testing gains and it all looks really similar! The drone just oscillates around weirdly semi-stably and randomly limps towards a target. I'm not sure if there's a way of isolating the rates or attitude controllers.

Or whether this is more hassle than its worth and I should try and interate the PID(?) Controller you have in this repo. End of the day all i want is some stable flight!

Thanks!

@knmcguire
Copy link
Member Author

hmm oke interesting that aerostack2 wasn't able to get this to work either to work in all this time, which is a bit worrying.

The difference is that they tried to get it to work with the gazebo's embedded velocity controller (based on lee's controller) https://gazebosim.org/api/gazebo/6.7/classignition_1_1gazebo_1_1systems_1_1MulticopterVelocityControl.html. I think this might be the most chance of success here, but unfortunate I wouldn't know how to tune this properly I'm afraid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants