OCCRA
Go to Post probably another ingenious game hint planted by Dave months before anyone even thinks about a game hint! - skimoose [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 03-17-2017, 12:07 AM
apache8080 apache8080 is online now
Addicted FRC Alumni
AKA: Rishi Desai
no team
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: San Jose, CA
Posts: 89
apache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond reputeapache8080 has a reputation beyond repute
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jaci View Post
I would like to respectfully tell you that I disagree.

C/C++ is only a pain if you let it be a pain. If you take the time to learn what's the safe way to do things, and what isn't, you won't have any problems with silent segfaults. Sure, there are many ways to go about doing something, but none of them are the same. You have to identify what is the best for your situation.

Sure, C++ might have a bigger learning curve than Java, but it's learning curve is a lot more _steady_ than Java's. The basics might take a little longer to learn than Java's, but keep in mind that a lot of people that "know" Java only know the basics. Reflection, classloading, security policies, native interfacing are all language features of Java that commonly go unrecognized, not to mention the entire JVM architecture itself.

If anything, C/C++ are the most relevant languages you can learn in your time in FRC, as this is likely what you will be dealing with if you wish to pursue embedded software engineering further. That being said, there's nothing wrong with Java and Python.

None of the FRC languages are bad, it just depends on what your priorities are and what you want to use them for.
I would agree that C/C++ are not bad languages at all too use in FRC, but using Java with high schoolers is a bit of an advantage since many of them have taken AP Computer Science.
__________________
Rishi Desai

Looking to mentor.

Student:
Team 5677, 2016-2017
Team 3256, 2013-2016
My GitHub
Reply With Quote
  #17   Spotlight this post!  
Unread 03-17-2017, 01:19 AM
cbale2000's Avatar
cbale2000 cbale2000 is offline
Registered User
AKA: Chris Bale
FRC #5712 (Gray Matter)
Team Role: Mentor
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Saginaw, MI
Posts: 1,254
cbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond repute
Re: FRC Programming, Done Right

Quote:
Originally Posted by apache8080 View Post
I would agree that C/C++ are not bad languages at all too use in FRC, but using Java with high schoolers is a bit of an advantage since many of them have taken AP Computer Science.
Intro to Java still had like 7 different prerequisite computer science classes when I took it at the College level a few years ago. Either a lot has changed since I was in high school or your area does things a lot different than they do here (AP computer science classes are even a thing that high schools have?).

Personally having taken both Java and C++, I always preferred C++ because it seemed to do the same things but more simply (creating variables, managing classes, etc.), but that could also just be because I learned C++ the semester before I took Java. Either way whatever language you know works, they do basically the same things.



Back to the specific topic of this thread however, one thing I think I would like to see is more pre-built code segments available to teams, that can be searched by, and include explanations of, their use cases. For example, my team struggled literally for years to have functional encoders on our robot, even after we started using CAN Talons, the documentation wasn't clear as to how to correctly use and configure them for use in different applications (drive-distance auton, teleop steering correction, shooter speed control, etc.). It would be great if there was just a page somewhere that provided some basic code options that teams could select based on their desired functionality and just copy and paste into their robot code. The section for PID control on this new website is a good example of the type of information teams typically find, it does a decent job at describing the concept behind PID, but completely leaves out any specific examples/details of its implementation (this is not meant to be critical of this site, as clearly it's still under development, but it was an easy example to use for this discussion).

Having resources like that would also be particularly helpful to teams who don't have a programming mentor (or who do but don't have FRC-specific experience), so that a mentor with limited programming knowledge could point a student who might have some experience with programming but no FRC experience to the resources they need to be able to implement features like vision/sensors and other more advanced features.

There's plenty of documentation out there already on the basics of programming in various languages, but I feel like there's very little (at least that I'm aware of) as far as organized repositories on how to program specifically for FRC uses, at least beyond the provided robot default code.

[/2am rant]
__________________
2005-2008: FRC 703 Phoenix - Driver
2009-2016: FRC 703 Phoenix - Mentor
2017-????: FRC 5712 Gray Matter - Mentor
Reply With Quote
  #18   Spotlight this post!  
Unread 03-17-2017, 01:37 AM
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 84
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: FRC Programming, Done Right

Quote:
Originally Posted by phurley67 View Post
Consider the following timeline:

Your robot is moving at 7ft/s following a slight (2/second) curve to the right while de-accelerating. Your camera camera captures an image with the peg vision targets. The vision processing code take 87ms to processes the image, giving you longitudinal and latitudinal offsets as well as the angle to the peg.

Assume everything above is accurate, you are well past the vision part of the problem and now in the thick of the control part of the problem. Your robot has moved over 7" since the image was taken along a complex path. Mix in the fact that you will be getting another 10-15 frames per second to continually adjust your loop against, might get hit by another robot, etc...

You can of course simplify the problem. Stop grab and process image. Rotate and move, etc. But realize that there is a spectrum of difficulty and for the most part, when given vision targets, the actual image processing is not the hardest piece of the puzzle

This is the hard (and fun) stuff.
Well said. It's wandering a bit off topic here, but the way we currently attack this is by buffering up all the relevant telemetry, and then use that info, along with the processing time of the frame, and we make the captured image data relative to the telemetry when the image was taken. Is this the right approach? Is there anything else we could do ontop of it to achieve better results?
__________________
But why?
Reply With Quote
  #19   Spotlight this post!  
Unread 03-17-2017, 02:55 AM
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 220
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jaci View Post
Just as a note, in the variables part of the document, I wouldn't recommend discussing things like what case to use for variables.

In C++, the standard library uses snake_case for functions, while WPILib uses CamelCase, while others might prefer lowerCamelCase. There is no 'right' way to do this, just like the argument of whether the open brace should be on its own line or not. Personally, I use snake_case in C++ and lowerCamelCase in Java, and with the open brace on the same line for both, but others might have different opinions.

The important thing is for it to be consistent.

I'll try and keep an eye on the project as it progresses and see if I can help. Good luck.
I like your code already. And concur that trying to explain naming conventions while teaching variables is a distraction.
__________________
3853 Pridetronics[

Reply With Quote
  #20   Spotlight this post!  
Unread 03-17-2017, 09:16 AM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 453
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jaci View Post
I would like to respectfully tell you that I disagree.
I didn't say C++ is bad. I said C++ is very difficult for beginners.

Quote:
Originally Posted by Jaci View Post
take the time to learn what's the safe way to do things, and what isn't ... The basics might take a little longer to learn than Java's.
That's exactly what I meant by "make your life difficult"
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org

Last edited by euhlmann : 03-17-2017 at 09:20 AM.
Reply With Quote
  #21   Spotlight this post!  
Unread 03-17-2017, 11:15 AM
mathking's Avatar
mathking mathking is offline
Coach/Faculty Advisor
AKA: Greg King
FRC #1014 (Dublin Robotics aka "Bad Robots")
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 1999
Location: Columbus, OH
Posts: 694
mathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond repute
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jaci View Post
In C++, the standard library uses snake_case for functions, while WPILib uses CamelCase, while others might prefer lowerCamelCase. There is no 'right' way to do this, just like the argument of whether the open brace should be on its own line or not. Personally, I use snake_case in C++ and lowerCamelCase in Java, and with the open brace on the same line for both, but others might have different opinions.

The important thing is for it to be consistent.
Good luck.
This is so important. Your team should have a style standards and you should adhere to them. I teach AP Computer Science, and I know that can be a pain. If I had a dollar for every time a student complained about having to follow my class standards and/or tried to explain to me why the standard we have is bad or inefficient I would be having a much better vacation trip this summer. But consistent standards for braces, indenting, variable names, commenting, and the like are vital for making debugging as easy as possible. That importance is only heightened when more than one person is creating code. Choose standards that make the code readable and follow them.

On the subject of language choice, please, please, please avoid discussions and value judgments as to one language's superiority over others. Your choice of language should be driven by your team's knowledge and experience. The choice is going to make some things easier and some things more difficult. That is almost always true of the choice between appropriate languages to complete any programming project. Do not try to use "what they will use in the real world" as your standard. If I only had students who were going to become developers or software engineers I would make them use LabView, because they might not otherwise encounter it. C++ and Java they will see in college. At this level we should be helping students learn how to develop, test and debug algorithms. If you learn how to write code well in one language, learning others is not going to be hard.

To answer a (rhetorical) question posed, yes indeed AP Computer Science is a thing high schools offer, even in Michigan. We have 70ish students per year at my school. Java is the language that AP (and IB) test in because it is the plurality language for first college courses. I am (or really used to be) more familiar with C++, but learning Java a dozen years ago when AP switched from C++ to Java was not difficult.
__________________
Thank you Bad Robots for giving me the chance to coach this team.
Rookie All-Star Award: 2003 Buckeye
Engineering Inspiration Award: 2004 Pittsburgh, 2014 Crossroads
Chairman's Award: 2005 Pittsburgh, 2009 Buckeye, 2012 Queen City
Team Spirit Award: 2007 Buckeye, 2015 Queen City
Woodie Flowers Award: 2009 Buckeye
Dean's List Finalists: Phil Aufdencamp (2010), Lindsey Fox (2011), Kyle Torrico (2011), Alix Bernier (2013), Deepthi Thumuluri (2015)
Gracious Professionalism Award: 2013 Buckeye
Innovation in Controls Award: 2015 Pittsburgh
Event Finalists: 2012 CORI, 2016 Buckeye
Reply With Quote
  #22   Spotlight this post!  
Unread 03-17-2017, 11:59 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
in hibernation
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,278
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: FRC Programming, Done Right

Quote:
Originally Posted by Maxwell777 View Post
Well said. It's wandering a bit off topic here, but the way we currently attack this is by buffering up all the relevant telemetry, and then use that info, along with the processing time of the frame, and we make the captured image data relative to the telemetry when the image was taken. Is this the right approach? Is there anything else we could do ontop of it to achieve better results?
This is pretty much the best approach. The devil is in the details of getting all of your measurements timestamped as precisely as possible.
Reply With Quote
  #23   Spotlight this post!  
Unread 03-17-2017, 12:03 PM
Loveless Loveless is offline
Registered User
no team
 
Join Date: Mar 2017
Location: Omaha
Posts: 21
Loveless has a spectacular aura aboutLoveless has a spectacular aura aboutLoveless has a spectacular aura about
Re: FRC Programming, Done Right

The docs now have a page on morphological operations!

Please let me know if something doesn't make sense on the page or if I should expand on something.
Reply With Quote
  #24   Spotlight this post!  
Unread 03-17-2017, 12:15 PM
marshall's Avatar
marshall marshall is online now
Discerning and exacting individual
FRC #0900 (The Zebracorns)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2003
Location: North Carolina
Posts: 1,833
marshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond repute
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jared Russell View Post
The trickiest parts of integrating vision have nothing to do with vision...they have to do with integration.
This is the one thing that no one seems to understand. Even our students don't always get this.
__________________
"La mejor salsa del mundo es la hambre" - Miguel de Cervantes
"The future is unwritten" - Joe Strummer
"Simplify, then add lightness" - Colin Chapman
Clarke's Laws
Reply With Quote
  #25   Spotlight this post!  
Unread 03-19-2017, 08:57 PM
Praj's Avatar
Praj Praj is offline
Registered User
FRC #6325 (Reset Robotics)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Alpharetta
Posts: 114
Praj is a jewel in the roughPraj is a jewel in the roughPraj is a jewel in the rough
Re: FRC Programming, Done Right

I would love to contribute to this. Vision is definitely something that many teams (especially rookie teams) think is impossible and crazy complicated. I thought this too and hard quite a hard time at first getting our vision tracking working and implemented. It gets a lot easier after knowing how to do it. I had a couple bumps along the way but 6325 will prove that vision tracking as a small rookie team with few resources is possible.
Reply With Quote
  #26   Spotlight this post!  
Unread 03-19-2017, 09:15 PM
mark219 mark219 is offline
Alumni/Programmer
AKA: Mark Szewczuk
FRC #0219 (Team Impact)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2015
Location: United States
Posts: 17
mark219 is an unknown quantity at this point
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jared Russell View Post
This is pretty much the best approach. The devil is in the details of getting all of your measurements timestamped as precisely as possible.
Off topic but...
I've been reading through your code on github from the past 2 years and it seems incredibly complex. One thing I noticed is that you guys don't use WPI's scheduler (or from what I can see) and you use your own scheduler, is there any benefit to doing this?
Reply With Quote
  #27   Spotlight this post!  
Unread 03-19-2017, 09:32 PM
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 277
TimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to beholdTimTheGreat is a splendid one to behold
Re: FRC Programming, Done Right

Quote:
Originally Posted by Praj View Post
I would love to contribute to this. Vision is definitely something that many teams (especially rookie teams) think is impossible and crazy complicated. I thought this too and hard quite a hard time at first getting our vision tracking working and implemented. It gets a lot easier after knowing how to do it. I had a couple bumps along the way but 6325 will prove that vision tracking as a small rookie team with few resources is possible.
Please do! Right now the other contributor has been working on creating a lot of docs since he has a background in VP, but more is always better. We really need to show how vision techniques are helpful/can be applied to FRC.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #28   Spotlight this post!  
Unread 03-20-2017, 09:28 AM
Praj's Avatar
Praj Praj is offline
Registered User
FRC #6325 (Reset Robotics)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Alpharetta
Posts: 114
Praj is a jewel in the roughPraj is a jewel in the roughPraj is a jewel in the rough
Re: FRC Programming, Done Right

I have created 2 small sections on HSV trackbars/sliders and converting to HSV colorspace (needed before doing inRange). I am thinking about maybe adding some GPU acceleration stuff for the TX1 and eventually how to calculate center X and formulas.
Reply With Quote
  #29   Spotlight this post!  
Unread 03-20-2017, 08:12 PM
calcmogul's Avatar
calcmogul calcmogul is offline
WPILib Developer
AKA: Tyler Veness
FRC #3512 (Spartatroniks)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Santa Maria, CA
Posts: 58
calcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nice
Re: FRC Programming, Done Right

I've been working on a similar set of documentation so I don't have to repeat myself so much . I'm considering integrating some of the content into "FRC Programming, Done Right" (FPDR), but I don't know how much of it you would be interested in. FPDR is intended to be a one-stop shop for information which provides the reader with everything they need to know, but my site is more a complement to lectures and activities the other software mentor and I provide. (I have limited time for documentation writing, so this is what 3512 does.)
Reply With Quote
  #30   Spotlight this post!  
Unread 03-20-2017, 10:56 PM
SamcFuchs's Avatar
SamcFuchs SamcFuchs is offline
Programmer
AKA: Sam Fuchs
FRC #0236 (TechnoTicks)
Team Role: Programmer
 
Join Date: Aug 2015
Rookie Year: 2014
Location: Old Lyme, Connecticut
Posts: 125
SamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud of
Re: FRC Programming, Done Right

Quote:
Originally Posted by Jared Russell View Post
The trickiest parts of integrating vision have nothing to do with vision...they have to do with integration.
Oh god yes. I can write opencv code in 30 minutes but I cannot for the life of me get it to be effective on a robot.
__________________
Sam Fuchs
236 TechnoTicks, Old Lyme, CT






2015 - Programming, Electrical
2016 - Lead Programmer, Co-Driver
2017 - Lead Programmer, Co-Driver
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 07:57 PM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi