robocup-software icon indicating copy to clipboard operation
robocup-software copied to clipboard

Port Robots_Per_Team constant into python, and refactor all magic number 6s

Open jcarn opened this issue 8 years ago • 7 comments

Right now we just use "6" in a few places. Magic numbers are bad, and we should replace them. There is a constant called "Robots_Per_Team" in Constants.hpp that would be perfect for this, but it is in the C++ section of the code. Use the robocup-py.ccp stuff to get that constant into python, and then change all 6s to that constant

jcarn avatar Apr 04 '17 23:04 jcarn

Actually we could use len(main.our_robots()) if we wanted

jcarn avatar Apr 06 '17 05:04 jcarn

len(main.our_robots) gives us the current number of robots we have (which we usually want) but the c++ constant gives us the max number of robots on a team (which is what a few plays, like stopped, need). I think we could make a function for len(our_robots) but we can't make it a constant since the number of robots we have might change in a match.

jgkamat avatar Apr 06 '17 05:04 jgkamat

@mmurley3 Are you still working on this? Robots_Per_Team would be the only constant exposed to python that (to my knowledge) doesn't belong to any specific class in C++. Which can be done but seems to go against the convention already established in robocup-py.cpp.

longoodr avatar Nov 19 '17 20:11 longoodr

Nah, I haven't had the time to make much progress on it. Feel free to tackle it if you want.

mmurley3 avatar Nov 19 '17 21:11 mmurley3

@jcarn Which files should we be looking at?

Jason27chan avatar Jul 17 '18 23:07 Jason27chan

This was more of an intro issue I had in mind

On Tue, Jul 17, 2018 at 7:25 PM, Jason Chan [email protected] wrote:

@jcarn https://github.com/jcarn Which files should we be looking at?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RoboJackets/robocup-software/issues/957#issuecomment-405759586, or mute the thread https://github.com/notifications/unsubscribe-auth/AQP1-oiqYokgVnvybvSoHBko48aIf2qlks5uHnKEgaJpZM4MzjA2 .

jcarn avatar Jul 18 '18 04:07 jcarn

@tjones320 this is a must-have before competition this year.

kylestach avatar Aug 29 '19 22:08 kylestach