Kinds-of-Intelligence-CFI / animal-ai

Animal-AI supports interdisciplinary research to help better understand human, animal, and artificial cognition.
https://sites.google.com/csah.cam.ac.uk/animalai/
Apache License 2.0
59 stars 9 forks source link

Improved raycastparser.py #29

Closed alhasacademy96 closed 1 year ago

alhasacademy96 commented 1 year ago

Hi peeps!

I've made major changes to the overall Raycastparser.py script.

Changes:

Documentation Added:

Type Annotations:

Dynamic Length Handling:

Code Readability:

Detailed Changes:

Documentation:

Type Annotations:

Robustness:

Code Readability:


Priority is HIGH for this pull so please do test as much as you can. All my unit testing produced successful returns but I haven't tested on training models such as Braitenberg.

-Ibrahim

wschella commented 1 year ago

Before I do a proper review, a question already: are we aware/ok that a raycaster can not detect the side of button pillar that has the button? Or is that not true?

wschella commented 1 year ago

I don't have time to properly test, but the code looks good. Definite improvement.

alhasacademy96 commented 1 year ago

I don't understand the question Wout can you elaborate? The button mesh of the pillar is a child object of pillar button which is indeed detectable if that's the question

wschella commented 1 year ago

I mean, can a raycast agent differentiate a pillarbutton observation from the back, from a pillarbutton observation from the front (where it can bump against the button)?

alhasacademy96 commented 1 year ago

That would require the entire pillar button mesh to be individualised which can be done. However it will increase the complexity by adding new raycast objects where currently it has just one entry. I could however add a unique tag to the actual button of the pillar button which can then be differentiated from the rest of the whole pillar button object/mesh. Did I answer your question? On 5 Sep 2023 at 12:38 +0300, Wout Schellaert @.***>, wrote:

I mean, can a raycast agent differentiate a pillarbutton observation from the back, from a pillarbutton observation from the front (where it can bump against the button)? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were assigned.Message ID: @.***>

wschella commented 1 year ago

That answers my question, thanks! Just something to be mindful off in documentation and explanation of the buttonpillar in the future.

kozzy97 commented 1 year ago

Hi everyone, I've spent a few hours looking at this and I can't get any of the old raycast-based stuff to work. There are a few things that I've noticed:

I'm going to keep exploring to see if I can find the issue, but I can't approve the PR till we can get the braitenberg vehicles working again.

kozzy97 commented 1 year ago

I'm happy that everything seems to work for now. It should be noted that I haven't been able to run tests with the new raycasting, so I'm not sure whether everything is working for the new AAI objects. However, reviewing the code, it ought to be flexible enough to handle this. @alhasacademy96 let us know when you have the new experimental build ready for the button, etc. and we can try it out.

For what it's worth, I've added an updated braitenberg script that we can run to check nothing has broken. You can request outputs from it to see what the raycasts are looking like. At the moment, I'm only getting 6 object types corresponding to the old ontology. I haven't been able to get more even when building afresh from animal-ai-unity, but perhaps I'm looking in the wrong place?

I'm going to approve this PR, as I think its purpose has been fulfilled. Thanks everyone!

kozzy97 commented 1 year ago

I'll leave it to you @alhasacademy96 to merge when you're happy (especially with the updated egg)

wschella commented 1 year ago

Not the first time there are some issues with the egg. As far as I know, this shouldn't even be committed to version control. This is normally generated by build tools like pip based on specifications like setup.py. So, @kozzy97, I don't think it's safe to specify dependencies in the egg, as opposed to in the setup.py.

We could merge right now, but I've already made #31 to not lose it out of sight.

alhasacademy96 commented 1 year ago

@kozzy97 can you look into the comments myself and Wout posted? I'm planning on merging on Sunday after the final details are done