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

Motor Delay #223

Open
zcase opened this issue Jun 28, 2024 · 2 comments
Open

Motor Delay #223

zcase opened this issue Jun 28, 2024 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@zcase
Copy link

zcase commented Jun 28, 2024

@JacopoPan do you know of a way to induce motor delay for a given time amount using the _pyhiics function or would we need to use the _dynamics function to do this?

Could we modify the step function to change:

if self.PHYSICS != Physics.DYN:
    p.stepSimulation(physicsClientId=self.CLIENT)

to

if self.PHYSICS != Physics.DYN:
    for _ in range(self.num_of_steps_for_dealy):
        p.stepSimulation(physicsClientId=self.CLIENT)

where the num_of_steps is calculated by doing something like:

motor_delay_ms = 100  # milliseconds
self.num_of_steps_for_dealy = int(pyb_freq * (motor_delay_ms / 1000))

I did try this but it seems to just instantly crash the drone.

@JacopoPan JacopoPan added question Further information is requested enhancement New feature or request labels Jul 31, 2024
@JacopoPan
Copy link
Member

I think the easiest way is to start implementing motor delay in the aviaries with RPM inputs and simulation stepped by PyBullet and simply by adding a buffer of actions that matches the delay measured in simulation steps (of course, in this case, the simulation integration step should be smaller than the delay we want to introduce).

@zcase
Copy link
Author

zcase commented Aug 2, 2024

I think I tried doing a first order low pass filter on the actions based of the motor delay and the simulation freq within the step function and that seemed to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants