Conversation
…and move finding angular radius and central axis of clusters into the visual mesh utility file
…ector sphericality measurement
…uct. add get green horizon side mask helper in visualmesh. revert new area based throwout logic to original angular standard deviation based logic for measuring sphericality
…, add merge preference
|
Have you tested on the real robot? |
I tested it last week on a bot and it was working but I've updated the logic since with the new fill based detection which I've only tested out on webots. I can try it out later on a robot |
Itd be nice to get some photos of results running in the robot as well. Images from the real robot tend to be noisier Try running a role with your module vs without then compare. I will try and review the code some time later |
ysims
left a comment
There was a problem hiding this comment.
Nice, and good job with testing using NUsight and the ball visualisations. Nice use of ternaries, good commenting throughout, including readme. I didn't go into the algorithm itself in this review, just some consistency and best-practice points.
JohanneMontano
left a comment
There was a problem hiding this comment.
Some changes need to be addressed
|
used a vector over vector everywhere cos bool vectors have this weird template specialisation where it packs 8 bools in a byte which leads to some overhead vs char vector as it needs to do some bit manipulation to access or write to the specific bit. does use more memory this way but doubt that's much of a factor for this code |
Are you sure that you're not worrying about something that the compiler might already be optimising for under the hood? I'd say just write it as simple as you can. Someone misunderstanding why we used chars and having a bad time debugging when something goes wrong later on is much more of a concern than wasting 7 bits if we do actually end up wasting that |
|
bool vec would have 8 bools per byte but since memory gets addressed by the byte when accessing an element from a vector of bools it has to some bit manipulation to get out the specific value which makes it a bit slower to access elements. vector char just wastes 7 bits in order to not do any bit manipulation, so vector of bools came out a bit slower though it depended on the case when I was benchmarking with -O3 enabled. I read my og comment which is pretty unclear which is probably related to me being a bit drunk then. Its not much of a speed improvement and maintainability would be more important so I'll change it back. |
As I said earlier, either you find some compiler flag to let it optimise this on its own, or just waste 7 bits and make the next maintainer's life a bit easier since using a char as a bool just isnt making a lot of sense. In fact, this isn't where we should be optimising for speed, it would be in the algorithm that is used to find clusters and determine the heuristics to merge the clusters. Similar with the vector of raw pointers to vectors, one should first and foremost be looking at the cppref docs to see if there already is a method for what one is looking for. |
… radius and and central axis functions accept more generic iterators
…t to allow balls to be displayed in NUsight without getting considered as possible balls by ball localisation
|
hey fixed everything that was requested. Ended up just adding a flag to the ball.proto message which marks if a balls been invalidated so that nusight can still get the positions of the discarded balls for debugging and I just changed ball localisation which was the only consumer of the vision balls message to not consider invalidated balls. For the vector of raw pointers to vectors I ended up just changing it up so the helper functions just accept an iterator and the caller just makes a view of what it needs to iterate over. Feel a bit iffy about it and saw ranges weren't used much in the codebase though if you've got suggestions. |






Sometimes the visual mesh can detect multiple clusters on the same ball, this aims to resolve that
Pre-PR Checklist:
Have you
Reviewers, Note
Tested in webots and can see its merging clusters properly when playing back the NBS file in nusight. Needs balldetector log level to debug or thrownout balls aren't emitted so they won't be visible in nusight. Jabulani texture seemed to split more often when testing it, can send the nbs file also. Thrownout balls are only emitted when ball detector has debug log level, originally measurements were also cleared so balls wouldn't be visible in nusight. I assume they were thrown out so ball localisation doesn't consider invalid balls, unsure if I should add something to the ball.proto that notes whether the balls valid, just keep the measurements as thrown out or if its not an issue as it'll only have effects when detector is in debug.
Fairly new to c++ and my first PR so I'm sure there's issues, feedback on anything is very appreciated.
Things left to do