|
|
|
![]() |
|
|||||||
|
||||||||
| View Poll Results: Have you, or do you plan to use Python for Robot code? | |||
| Never used it before, and probably never will. |
|
17 | 58.62% |
| Used it in the past, but probably not this year. |
|
0 | 0% |
| Haven't used it before, but plan to this year. |
|
6 | 20.69% |
| Used it last year, and probably will use it again this year. |
|
5 | 17.24% |
| What is python? |
|
1 | 3.45% |
| Voters: 29. You may not vote on this poll | |||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: Teams who have used or plan to use python for Robot Code
Just providing some additional datapoints we use in helping choosing a language for our team.
First to answer the OP question: We used the python port of network tables last year, and plan to use it again if available in 2015. We program the robot in Java, and Vision in C++. We teach our kids Java only because that is most likely the language they will be learning going to college, so we feel this gives them a leg up on the rest of applicants. After all, that is our primary mission. It is very important to make the distinction for your team: Are you a team who has mentors whom can teach the language and solve problems, or is your team student driven, and they which to follow a certain language. If the students are passionate about a certain language, try your best to accommodate that. My first language was C++ and assembly of a 8051. In terms of easy to learn: My opinion is that Java is a good first start language, especially for someone who hasn't programed before. The reason I say this is because Java is still a compiled language (technical it is 1/2 compiled and 1/2 interpreted), and the sytax it has is pretty easily identifiable in many other mainstream languages (C++/C# which are used extensively in industries today). For our specific use of Robotics because Java is a compiled language some errors can be identified at compile time, making code easier to debug, and faster to correct. There are still run-time errors that you can not get away from. Python is a scripting language and its syntax is very similar to other scripting languages like Matlab (which I use everyday at work) but is rather different than mainstream languages. I think it is easier to learn Python syntax after knowing Java, then trying to learn Java syntax after knowing python. I believe it is a lot easier to remove things from syntax, than to add them (like the necessity of brackets in Java, but the lack of them in python). (I also believe it is easier to learn Java after knowing C++, rather than trying to learn C++ after knowing Java, like dealing with destructors) Python, is not a compiled language, it is an interpreted language, so the only errors you find are that at run-time. In my opinion, and this is only my opinion, it is harder to program Robots because errors are caught much later in the process. Now, if FRC was a work assignment that I was doing on my own, my language of choice would be C++. This is because our task is an embedded application, and the C++ language gives the advanced user extreme control over execution, direct access to the operating system, and we get rid of any interpreter overhead by the java virtual machine. However, because our goal is to give our students experience in a language they are more likely to use in college and personal projects (mobile apps, etc.), our language of choice is Java. In the end, it doesn't really matter what language you choose, all can get the job done in FRC as we have seen over the years, choosing the language which best suits your team must come from some external reason. There is no right answer for FRC alone. However, one pro of python is that you can write the same application much quicker and with a lot fewer lines than its C++ or Java counter part. That's because python removes all the extraneous syntax. When coding advanced algorithms, I typically code them in matlab first (another scripting language), just to get the logic right and not have to worry about syntax of Java and C++. Python and Matlab has that "It just works" feeling when writing code. Once I have the algorithm set in the scripting language, I can convert it to Java or C++, its a much quicker and easier process. Also, python modules for scientific calcs blow Java and c++ libraries for similar purposes out of the water in my opinion in terms of availability and ease of use. Hope this helps, Kevin P.S I am fully aware there are modules which you can use to compile python first, but in my opinion, its a waste of the reason you use the python language. Let the python interpreter compile and interpret in real time, with the efficiencies built in, like it was meant to do. P.P.S Thank you to all that are working on the python FRC port. It is an invaluable resource, and without their efforts we wouldn't even be able to consider python an option. |
|
#17
|
|||||
|
|||||
|
Re: Teams who have used or plan to use python for Robot Code
I agree with Kevin that I'd be very hesitant to use a non-compiled language for on-robot code during competition. More and more large web companies are discouraging Python in production code because it is too easy for small errors to sneak past static analysis tools, and achieving 100% code coverage in unit tests is almost impossible. An unanticipated runtime error on a robot could be disastrous.
Using Python during prototyping, as a non-essential process on the robot (ex. logging, web server, etc.) or on the driver station? I'm a huge fan! |
|
#18
|
||||
|
||||
|
Re: Teams who have used or plan to use python for Robot Code
We tried out python at both our off-season competitions after using java in our 2014 season. We had no issues with it and due to a number of our rookies having prior python experience we will probably use it in the upcoming season. While I'm not the programmer I usually end up adjusting a few variables and being able to program the robot with just a ssh client was a really useful feature.
While their are some disadvantages to using it, notably in support and reliability keeping our programmers happy and working quickly especially when we only have 1 or 2 is a fair trade-off for us. |
|
#19
|
||||
|
||||
|
Re: Teams who have used or plan to use python for Robot Code
Regarding Jared's point -- runtime errors are definitely a real concern when using a language like python. However, a big focus of RobotPy development in the last few years has been improving off-robot testing capabilities. While it's definitely difficult to get to 100% code coverage, robot code in FIRST is generally simple enough where you can get to 'good enough'. Besides, learning how to make your code robust in the face of unexpected errors is a good thing.
Last season I don't think there was a single time in a competition match where our robot crashed because of a runtime error that a compiled language would have caught. The practice field is a different story, however... |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|