OCCRA
Go to Post We also have a CNC mill and CNC lathe, but we're interested in doing this only if we can do it quickly. Milling anything takes too long for my MTV-generation attention span. :) - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2018, 12:31 PM
itsmechuckb itsmechuckb is offline
Registered User
FRC #0997
 
Join Date: Oct 2018
Location: Corvallis, OR
Posts: 9
itsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of light
No, You Don't Need A Robot To Test Your Code

Ok, it is more fun...

But, don't you want some early gratification?

VSCode's JUnit runner integration and a mocking framework like Mockito gives you all you need to test your code (with a little bit of thoughtful design).

I just did a video that demonstrates testing a vision processing project...no camera or robot required.

This is such an important topic, I will be releasing more videos in the future. Subscribe to our channel to see more.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2018, 06:56 PM
itsmechuckb itsmechuckb is offline
Registered User
FRC #0997
 
Join Date: Oct 2018
Location: Corvallis, OR
Posts: 9
itsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of light
Re: No, You Don't Need A Robot To Test Your Code

I got so much good feedback, I did another video about automated testing of generic robot projects using VSCode, JUnit, and Mockito. Source code for the video is here. My suggested changes to make testing work are in the branch called CCBFeedback.

Enjoy.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2018, 07:57 PM
Prateek M's Avatar
Prateek M Prateek M is offline
Kotlin Master Race
FRC #5190 (Green Hope Falcons)
Team Role: Programmer
 
Join Date: May 2018
Rookie Year: 2018
Location: Cary, North Carolina
Posts: 41
Prateek M is on a distinguished road
Re: No, You Don't Need A Robot To Test Your Code

This looks great. Thanks for the awesome resources!
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2018, 09:28 PM
gerthworm's Avatar
gerthworm gerthworm is offline
Making the 1's and 0's
FRC #1736 (Robot Casserole)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Peoria, IL
Posts: 711
gerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond reputegerthworm has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by itsmechuckb View Post
no camera or robot required.
To test the logic & general behavior of the code? Yah, you can definitely do checkout on that on the development PC, prior to getting on any real hardware.

But, to test that the execution happens quickly enough? Or that the camera is integrated properly? Or that the robot moves properly in response to command? Usually there are things you'll still need hardware to fully validate.

Don't get me wrong, testing frameworks will help you get a lot of the work done before getting on robot hardware and are super useful! I don't see nearly enough of them in FRC circles.

Still, keep in mind, even with the best test suite ever, you haven't fully eliminated the need to test on real hardware. Don't let those pesky project planners take all that time away !

Edit: Also don't get me wrong, project planning (or planners) isn't a bad thing either! But, don't swing too far the other way ("We don't need any time on robot to test!"). Only a sith deals in absolutes!

Thanks 997 for putting this together! I do hope we're able to incorporate it into our code this year!

Last edited by gerthworm : 11-02-2018 at 09:37 PM. Reason: A bit of wording.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-04-2018, 08:51 PM
Jaci's Avatar
Jaci Jaci is offline
http://imjac.in/ta/name
AKA: Jaci R Brunning
FRC #5333 (Can't C#) #5663 (Ground Control) | (OpenRIO, FRC West Aus)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 628
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

FWIW, the new simulation frameworks in WPILib and the supporting tasks in GradleRIO allow you to simulate your robot as well, if you're willing to do some manual plumbing.

Here's a simple GUI application I'm using to teach my students robot programming, with a few other structures (like a pendulum balancing task for teaching PID, and a few other things planned). The GUI is made with OpenCV, which is already included in WPILib so you don't have to pull in any extra deps.

In this case, the simulator helps students design their code, which is then validated against a unit test once they're confident the code is working as intended.

https://i.imgur.com/pgOqE8f.gifv

https://github.com/CurtinFRC/PreseasonSim

Footnote: once we start getting closer to the season I'm going to integrate the simulator with some physics-correct models, making it possible to test the "feel" of the driving controls, as well as allowing testing of motion profiling and autonomous
__________________

Curtin FRC (5333+5663) : Head Mentor
WPILib : Developer

Website | Github
jaci.brunning@gmail.com
Reply With Quote
  #6   Spotlight this post!  
Unread 11-05-2018, 11:09 AM
Matt G's Avatar
Matt G Matt G is offline
365 --> 4039
AKA: Mattward
FRC #4039 (Makeshift)
Team Role: Mentor
 
Join Date: Apr 2015
Rookie Year: 2009
Location: Ontario
Posts: 71
Matt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond reputeMatt G has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Jaci View Post

Here's a simple GUI application I'm using to teach my students robot programming, with a few other structures (like a pendulum balancing task for teaching PID, and a few other things planned). The GUI is made with OpenCV, which is already included in WPILib so you don't have to pull in any extra deps.
I stumbled across this web page recently, which seems similar to your gui:

http://janismac.github.io/ControlChallenges/

It's all in-browser and most of the problems can be solved with simple PID. I've been using it as a resource to teach control loops.
Reply With Quote
  #7   Spotlight this post!  
Unread 11-05-2018, 11:52 AM
itsmechuckb itsmechuckb is offline
Registered User
FRC #0997
 
Join Date: Oct 2018
Location: Corvallis, OR
Posts: 9
itsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of lightitsmechuckb is a glorious beacon of light
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Jaci View Post
FWIW, the new simulation frameworks in WPILib and the supporting tasks in GradleRIO allow you to simulate your robot as well, if you're willing to do some manual plumbing.

Here's a simple GUI application I'm using to teach my students robot programming, with a few other structures (like a pendulum balancing task for teaching PID, and a few other things planned). The GUI is made with OpenCV, which is already included in WPILib so you don't have to pull in any extra deps.

In this case, the simulator helps students design their code, which is then validated against a unit test once they're confident the code is working as intended.

https://i.imgur.com/pgOqE8f.gifv

https://github.com/CurtinFRC/PreseasonSim

Footnote: once we start getting closer to the season I'm going to integrate the simulator with some physics-correct models, making it possible to test the "feel" of the driving controls, as well as allowing testing of motion profiling and autonomous
Thank you for those resources. I noticed some inkling of this while looking at wpilib source this morning. I would be interested in helping to produce more vids with good samples showing how to do more testing without a bot.
Reply With Quote
  #8   Spotlight this post!  
Unread 11-05-2018, 02:13 PM
Dan Katzuv Dan Katzuv is offline
Registered User
FRC #5987 (Galaxia in memory of David Zohar)
Team Role: Programmer
 
Join Date: Feb 2018
Rookie Year: 2017
Location: Haifa, Israel
Posts: 31
Dan Katzuv is an unknown quantity at this point
Re: No, You Don't Need A Robot To Test Your Code

Thank you very much! Testing our code without a robot is something we want to get into this year, and these resources seem like the exact thing we looked out for .
Reply With Quote
  #9   Spotlight this post!  
Unread 11-05-2018, 11:25 PM
Jaci's Avatar
Jaci Jaci is offline
http://imjac.in/ta/name
AKA: Jaci R Brunning
FRC #5333 (Can't C#) #5663 (Ground Control) | (OpenRIO, FRC West Aus)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 628
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Matt G View Post
I stumbled across this web page recently, which seems similar to your gui:

http://janismac.github.io/ControlChallenges/

It's all in-browser and most of the problems can be solved with simple PID. I've been using it as a resource to teach control loops.
Yup! I use that as further reading for my students if they want to play around with control a little more.

The main reason we still use the simulator in class is that it's all within the development environment we'd expect to use in class. In this case, the platform is also physics-correct for a single CIM motor driving a 50kg mass through a 16:1 reduction, which will come in particularly useful for when we start simulating elevators with different motor configurations
__________________

Curtin FRC (5333+5663) : Head Mentor
WPILib : Developer

Website | Github
jaci.brunning@gmail.com
Reply With Quote
  #10   Spotlight this post!  
Unread 11-09-2018, 02:28 PM
SilentWanderer SilentWanderer is offline
Registered User
FRC #1885 (ILITE Robotics)
Team Role: Programmer
 
Join Date: Nov 2016
Rookie Year: 2016
Location: Haymarket
Posts: 3
SilentWanderer is an unknown quantity at this point
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Jaci View Post
FWIW, the new simulation frameworks in WPILib and the supporting tasks in GradleRIO allow you to simulate your robot as well, if you're willing to do some manual plumbing.

Here's a simple GUI application I'm using to teach my students robot programming, with a few other structures (like a pendulum balancing task for teaching PID, and a few other things planned). The GUI is made with OpenCV, which is already included in WPILib so you don't have to pull in any extra deps.

In this case, the simulator helps students design their code, which is then validated against a unit test once they're confident the code is working as intended.

https://i.imgur.com/pgOqE8f.gifv

https://github.com/CurtinFRC/PreseasonSim

Footnote: once we start getting closer to the season I'm going to integrate the simulator with some physics-correct models, making it possible to test the "feel" of the driving controls, as well as allowing testing of motion profiling and autonomous
Woah.
Reply With Quote
  #11   Spotlight this post!  
Unread 11-16-2018, 08:21 AM
Rami Marelly Rami Marelly is offline
Registered User
FRC #3339
 
Join Date: Feb 2017
Location: Israel
Posts: 5
Rami Marelly is an unknown quantity at this point
Re: No, You Don't Need A Robot To Test Your Code

Hi,
Thank you very much for the video.
We have tried to use JUnit in VSCode (no mocking env. yet) to unit test simple functions but whenever we run them we get a message that the tests are skipped.
Do you know what might be the problem?
Thanks,
Rami.
Reply With Quote
  #12   Spotlight this post!  
Unread 11-16-2018, 08:42 AM
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
R I P Georgia Dome
FRC #1102 (M'Aiken Magic & Team FUN)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: Augusta, GA
Posts: 1,925
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Rami Marelly View Post
Hi,
Thank you very much for the video.
We have tried to use JUnit in VSCode (no mocking env. yet) to unit test simple functions but whenever we run them we get a message that the tests are skipped.
Do you know what might be the problem?
Thanks,
Rami.
Is your code on GitHub? It is much easier to diagnose these things when you have code to look at.
__________________
John Fogarty - 13 Years in FIRST - http://cceti.com
FLL 1102 -> FTC 3864/1102 | FRC 1102 -> FRC 1772 -> FRC 4901 -> FRC 5632 | FTC 11444 -> FRC 1102 | VRC 5817
Head Coach - FRC Team 1102 M'Aiken Magic
"By teaching students the power of STEM, we're M'Aiken Magic happen!"
2010 FTC World Championship Winner - FTC Team 3864 Driver/Captain
Reply With Quote
  #13   Spotlight this post!  
Unread 11-16-2018, 07:23 PM
Jaci's Avatar
Jaci Jaci is offline
http://imjac.in/ta/name
AKA: Jaci R Brunning
FRC #5333 (Can't C#) #5663 (Ground Control) | (OpenRIO, FRC West Aus)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 628
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: No, You Don't Need A Robot To Test Your Code

Quote:
Originally Posted by Rami Marelly View Post
Hi,
Thank you very much for the video.
We have tried to use JUnit in VSCode (no mocking env. yet) to unit test simple functions but whenever we run them we get a message that the tests are skipped.
Do you know what might be the problem?
Thanks,
Rami.
If you don't have a desktop toolchain installed (Visual Studio 2017 for Windows, GCC or Clang for other platforms), the builds are skipped.
__________________

Curtin FRC (5333+5663) : Head Mentor
WPILib : Developer

Website | Github
jaci.brunning@gmail.com
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:13 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi