![]() |
Re: Potential Git and CI integration
Quote:
Quote:
Quote:
That said, I still think even testing "is my motor spinning" is a huge improvement over what most teams do (no testing at all). |
Re: Potential Git and CI integration
I think there is real value in testing with a simulator. I don't think it's the right tool for typical unit tests, and I probably wouldn't use it to tune PID constants either; the real value in the simulator is in being able to see all the pieces work together and interact with each other and the environment. Off the top of my head, I might put together an interface that looked something like this:
Code:
struct Object_status{ |
Re: Potential Git and CI integration
Quote:
In python, it's far more important to do off-robot testing because it's a dynamic language -- there's a large risk of crashing due to misspelled variables, etc. Because of this we've had excellent test/simulation support for several years now. In the course of development for the pyfrc simulator/test harness, we have a set of 'default' tests that just do the following things:
And this meets the needs for most of our robot code -- eg, make sure it doesn't crash due to misspelling of a variable name. However, we've found there is *some* value in junit-style tests -- but usually we only go to the trouble of writing those when you've got a complex state machine that you want to make sure deals with the edge cases correctly. |
Re: Potential Git and CI integration
Quote:
Testing all depends on what you put in it. If you are going to try to mock out a robot subsystem to do unit testing, you are going to have a bad day. Figuring out by hand what a system should return is hard. If you write a simulated subsystem with simulated sensors to support more of an integration test, you can get some very powerful results. You can model almost all FRC subsystems as a motor attached to a mass. We do pretty exhaustive automated testing of all our control loops and motion profiles, all inside google-test in C++. Last time I counted, we had 20+ tests for our superstructure, and many more tests for things like motion profiles. If you can't control a model of your robot pretty well, you have no hope of controlling the real thing. Unit tests are also very helpful at helping you understand when smaller units of code are performing as expected. This enabled us to have all the software we wrote before the hardware was done this year up and running on the robot in 24 hours, with no modifications after calibrating pots and measuring limit locations. Our arm and flywheel controllers all worked pretty well and were stable, just from the quality of our simulations. That's pretty powerful and well worth the investment. Motion profiles are actually much easier to test than controllers. You can compute ideal trajectories and see if your generator successfully generates and follows them. You can also write tests making sure they have the bounded acceleration characteristics you expect and bounded velocity characteristics. I believe that FRC should try to teach some of the best practices in industry to our students. Testing is a key part of developing and maintaining production software. I write both unit tests and integration tests in both industry (safety critical vehicle automation) and at robotics, and it drastically helps the code quality in both locations. |
| All times are GMT -5. The time now is 22:31. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi