StanfordASL / neural-network-lyapunov

Synthesizing neural-network Lyapunov functions (and controllers) as stability certificate.
MIT License
139 stars 30 forks source link

Example training px4 Lyapunov #445

Closed Aleksej9521 closed 7 months ago

Aleksej9521 commented 1 year ago

Hi, great repo :) I'm starting to work with some examples, in particular the px4 one. I have one question: in train_forward_model the notation "_sp " is related to setpoint or speed?

blandry commented 1 year ago

Hello! _sp refers to the setpoint that's right.

Aleksej9521 commented 1 year ago

Thanks! I'm also new to the px4 and drone world. Where can I read to clearly understand how and from where to take the data for this training?

blandry commented 1 year ago

I believe we never actually got around to getting data for this specific example (it's not mentioned in the paper). If I recall correctly though the idea was to train a high level position controller on top of the existing PX4 attitude controller. The attitude controller takes an attitude setpoint (roll, pitch, yaw) and a thrust setpoint, and uses its internal state estimate (attitude + rates) to produce the motor commands (with a cascaded PID). In theory you could try to learn a position controller that drives a position error (dx, dy and dz) to zero over time. I actually think this would work, we just didn't get around to doing it... The hint to this is the comment we wrote

    # The forward model maps (roll[n], pitch[n], yaw[n],
    # roll_sp[n], pitch_sp[n], yaw_sp[n], thrust_sp[n]) to
    # (dx[n+1] - dx[n], dy[n+1] - dy[n], dz[n+1] - dz[n], roll[n+1] - roll[n],
    # pitch[n+1] - pitch[n], yaw[n+1] - yaw[n])

@hongkai-dai might remember this better than me though.

hongkai-dai commented 1 year ago

As you said, we never really trained the dynamics model or the Lyapunov function for PX4.

Aleksej9521 commented 1 year ago

Okay, thank you for all the replies :)

Aleksej9521 commented 9 months ago

Hi, I'm re-opening this issue to ask a quick question: how can I test the quadrotor 3d simulation in pybullet? I'm not able to find the relative code in the repository.