-
Notifications
You must be signed in to change notification settings - Fork 10
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
Confusion about the implementation of accelerate method in SlidingAgent #6
Comments
You are right, there seems to be an issue with the magnitude, and apparently the angle too, I started to do research on hybrid agent, I changed topic before even finishing this piece of code, I still finished it and released it as I thought it would be useful for some people, however this environment was not fully tested. As I remember, the inertia was managed by basically increase the speed by a certain amount, during one timestep (because "acceleration = delta(speed) / delta(time)" and delta t in our case is one timestep). gym-hybrid/gym_hybrid/agents.py Line 40 in 2c2eb39
I assumed that the agent has a speed towards phi and a speed of "acceleration" (that lasts only one timestep) towards theta (the value of the speed is equal to the acceleration for the same reason I explained in the previous paragraph). I will correct the two equations when I have time, however if you find some better way to handle that I would be please to hear it. Theta is the angle of the agent with the board as reference. It means that the agent is pointing towards theta. However the velocity vector is pointing towards phi. (this means that if we accelerate, we accelerate in the direction of the agent (theta) and not the direction of the existing velocity (phi)) Now that I reread my code, your question and my answer, it is possible that I am missing a delta_t where I am accelerating (but not sure sure, I think some tests may need to be written to see how much acceleration is provided if doing so, maybe too much or too little). Would it be possible to do a MR or send me a message with the changes that you think are right, so I can review it thereafter ? I currently do not have much time to take care of this |
Thanks a lot for your explanation, I may think of a way to fix this issue and contact you later. |
I think I fixed the magnitude and the angle using the equation from stackoverflow. I will write tests when more time will be in my hand. Please let me know if you found further adjustments to make. |
Hello, I am kind of confused about the implementation of the accelerate method at here
According to the following formula from stackexchange (as mentioned in L58),
to calculate the magnitude of the sum of to polar vectors, we need to know the magnitudes and angles of these two polar vectors, and I think
self.speed
andspeed
represent the magnitudes, but I don't understand why they're used to calculate the cosine value bynp.cos(value - self.speed)
(instead of something represents the angle). By the way, I don't quite understand the way you simulate inertia, from my physics knowledge, it may be necessary to use some variables to represent the 'acceleration' or 'derivative' which specifies how fast the speed changes, am I right ?Also, I wonder what does "direction of the agent" mean at here and what's the difference between "direction of the agent" and "angle of the velocity vector".
Your timely response will be greatly appreciated.
The text was updated successfully, but these errors were encountered: