RoboJackets / robocup-software

Georgia Tech RoboJackets Software for the RoboCup Small Size League
Apache License 2.0
178 stars 187 forks source link

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

Open jcarn opened 7 years ago

jcarn commented 7 years ago

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 commented 7 years ago

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

jgkamat commented 7 years ago

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.

longoodr commented 6 years ago

@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.

mmurley3 commented 6 years ago

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

Jason27chan commented 6 years ago

@jcarn Which files should we be looking at?

jcarn commented 6 years ago

This was more of an intro issue I had in mind

On Tue, Jul 17, 2018 at 7:25 PM, Jason Chan notifications@github.com 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 .

kylestach commented 5 years ago

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