Skip to content

[Dynamics] Drone dynamics#83

Merged
matteobettini merged 16 commits intoproroklab:mainfrom
gy2256:main
Feb 16, 2024
Merged

[Dynamics] Drone dynamics#83
matteobettini merged 16 commits intoproroklab:mainfrom
gy2256:main

Conversation

@gy2256
Copy link
Contributor

@gy2256 gy2256 commented Feb 7, 2024

The dynamics require testing. Flying this manually is challenging because the action contains [Total_thurst, Torque_x, Torque_y, Torque_z]. I will code a separate LQR controller (as a heuristic controller) for testing.

Copy link
Member

@matteobettini matteobettini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very very cool, here a first round of comments

@matteobettini matteobettini changed the title Add drone dynamics [Dynamics] Drone dynamics Feb 7, 2024
matteobettini and others added 6 commits February 7, 2024 10:28
Co-authored-by: Matteo Bettini <55539777+matteobettini@users.noreply.github.com>
1. the mass is obtained from self.agent.mass now
2. Updated how the drone_state is initialized
Copy link
Member

@matteobettini matteobettini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Did you format it already?

As we discussed it would be useful to have a function needs_resetting that returns a boolean tensor of shape n_envs telling if the drone is in an unrecoverable state for each env

We should have a debug scenario for this (like for diff drive) where users can test it.
Maybe this will need a simple controller layer.

@gy2256
Copy link
Contributor Author

gy2256 commented Feb 15, 2024

I will add needs_resetting.

Speaking of the debugging scenario, I also want to manually fly the drone with the raw control inputs [thrust, torque_x, torque_y, torque_z]. Then, I can provide an LQR controller for debugging, where a user inputs forces.

Is the following code a good place to start?
https://github.com/proroklab/VectorizedMultiAgentSimulator/blob/main/vmas/interactive_rendering.py

@matteobettini
Copy link
Member

I will add needs_resetting.

Speaking of the debugging scenario, I also want to manually fly the drone with the raw control inputs [thrust, torque_x, torque_y, torque_z]. Then, I can provide an LQR controller for debugging, where a user inputs translational velocities.

Is the following code a good place to start? https://github.com/proroklab/VectorizedMultiAgentSimulator/blob/main/vmas/interactive_rendering.py

Yes, executting a scenario with a drone and that will let you control the first 3 actions (action one with left/right, action 2 with up/down, action 3 with m/n). (This buttons will do -/+ max_range whioch you set upon agent construction)

In your case you have 4 actions so we might need a workaround for that.

Regarding the controller, look at velocity_controller. You can make a similar one that it is called in process_action before the dynamics.

We can decide if we want the input of this to be forces and torque or velocities.

The agent now behaves correctly using the interactive rendering.
@matteobettini matteobettini merged commit d588548 into proroklab:main Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants