Go to Post It's not about going for any of the awards. Awards are to recognize what you are doing for First, your team, and the community. - SaraBailey [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-12-2007, 02:16
roboxking roboxking is offline
Registered User
AKA: Chris
FRC #2584 (Reseda Regent Robotics)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2006
Location: Encino
Posts: 4
roboxking is an unknown quantity at this point
Programming in Python and Explaination of Programming

Our team has decided to use Python for programming, instead of C. Does anyone know how to do that. I also need a general explanation of how programming works in general. This is our first year in FRC, and in FVC (now FTC) all we did was use EasyC, so how programming worked wasn't an issue. Thanks for the help anyone can give me.
  #2   Spotlight this post!  
Unread 31-12-2007, 08:29
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: Programming in Python and Explaination of Programming

The FRC controllers are written in straight ANSI C. It is not C++. We don't do objects.

Inside the controller is a ton of code that has the framework where you hang your custom code for autonomous and a routine that you modify to do your normal hands on control. A lot of the work is setup for you already in terms of conditioning I/O points and setting up interrupt handlers, etc.

Considering that IFI has done 90% of the code for you it is impractical and unnecessary to consider another language.

This competition reflects real life. Just like a real life project the language may have been chosen before you arrived for any of a million reasons.

Besides, professional programmers are adept at:

a - picking the right tool for the job
or
b - using the tools that have been chosen when not given the choice.

BTW - If you used a coprocessor like the gumstick you could eventually get to the point of building support for python but that project isn't for a newbie programmer. You only have 6 weeks to finish this whole robot project.

Good Luck !!
__________________
Ed Barker

Last edited by ebarker : 31-12-2007 at 08:40. Reason: btw - gumstick
  #3   Spotlight this post!  
Unread 31-12-2007, 11:59
Robostang 548's Avatar
Robostang 548 Robostang 548 is offline
I can program the future...
AKA: Don
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Northville Mi
Posts: 69
Robostang 548 is on a distinguished road
Send a message via AIM to Robostang 548 Send a message via MSN to Robostang 548 Send a message via Yahoo to Robostang 548
Re: Programming in Python and Explaination of Programming

My team will be programming our 2008 robot in python. We are trying to get an off board coprocessor working. Team 245 did a workshop on using a coprocessor at last years kickoff in Novi Mi. They did their coprocessor in python and for a time, they had their code on their website. I don't know if team 245 will be using a coprocessor this year or if they will be giving support to their code because their two main programmers who wrote the code graduated last year. In terms of getting python to work on the RC alone, I cant help you much there. But there is rumor that the new controller that will be available in the 09 season will have support for multiple languages.

-Don
__________________

Team 548:
Attending National Championship, Genesee District, Detroit District 2, West Michigan District, Michigan Championship?


  #4   Spotlight this post!  
Unread 31-12-2007, 13:02
tajmorton tajmorton is offline
Registered User
FRC #0847 (PHRED)
Team Role: College Student
 
Join Date: Nov 2007
Rookie Year: 2008
Location: Philomath, OR
Posts: 10
tajmorton is a jewel in the roughtajmorton is a jewel in the roughtajmorton is a jewel in the roughtajmorton is a jewel in the rough
Send a message via AIM to tajmorton
Re: Programming in Python and Explaination of Programming

Quote:
Originally Posted by roboxking View Post
I also need a general explanation of how programming works in general.
Check out the guide that Team 1540 (The Flaming Chickens) put together: http://www.team1540.org/programming.
It's a great overview of how the default code is setup, and how to modify it.

[Assuming that you are going to use C...otherwise please ignore ]
As for learning C, if you already know some Python (or another language), I don't think the jump will be too huge. A lot of being a programmer is the way you think, not the syntax you write (for me, anyway). That said, you might want to dip your toes in the C-sea before you have to write embedded code on a deadline.

On Windows, I've used the Dev-C++ IDE (uses a GCC compiler). Despite its name, it can be used for both C and C++ programming. Look up some C tutorials on the web and try writing some simple programs (something that reads a file and prints it on the screen, something that computes the area of a circle from its radius, something that computes the hypotenuse of a right triangle, etc)--just some simple stuff to learn the syntax. I can't really recommend and C tutorials, but a quick google brought up this this one (and many others).

- Taj
  #5   Spotlight this post!  
Unread 31-12-2007, 20:35
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Programming in Python and Explaination of Programming

Quote:
Originally Posted by tajmorton View Post
A lot of being a programmer is the way you think, not the syntax you write (for me, anyway). That said, you might want to dip your toes in the C-sea before you have to write embedded code on a deadline.
I would definately agree. Once you get the hang of programming itself, learning syntax really isn't as hard as you would think. I would give C a try.
__________________
  #6   Spotlight this post!  
Unread 31-12-2007, 21:04
EricH's Avatar
EricH EricH is offline
New year, new team
FRC #1197 (Torbots)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: SoCal
Posts: 19,726
EricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond repute
Re: Programming in Python and Explaination of Programming

Is EasyC going to be available for FRC again? If so, problem (partially) solved.
__________________
Past teams:
2003-2007: FRC0330 BeachBots
2008: FRC1135 Shmoebotics
2012: FRC4046 Schroedinger's Dragons

"Rockets are tricky..."--Elon Musk

  #7   Spotlight this post!  
Unread 01-01-2008, 19:33
hdanak hdanak is offline
Registered User
FRC #2584 (Reseda Regents Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: California
Posts: 13
hdanak is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

not meant as a reply, just some thoughts:

It interesting to see what real speed advantage the coprocessor would give. Python is generally 16x slower than native, so it would seem that (if true) the Python code would run more slowly on a 400 mhz computer than native c on the 40 mhz (i think) PIC mcu. But it might be worthwhile just using C on the coprocessor, which may or may not be against the purpose of a coprocessor. I think python would be worthwhile for extra control speed (using heavily optimized code, or more likely, native imported code), ease of development (the mcc18 C is not exactly ANSI C, so it would be generally easier to use a higher layer of abstraction instead of dodging all the pitfalls and differences; though it may take some work to setup), and portability of code (we could use a straight cvs/svn/bazaar rep to manage the code which is generally more modular and clean-cut than the C code). Other than that, its way easier to get new programmers in the team learn python than C (well, depends on how thoroughly they think of a problem; if they could live in abstraction, python is easy); it would generally take a day or two to pickup the python syntax (after the general compsci aspect is explained) vs a week for C (which would also require a thorough knowledge of the PIC18 mcu before any programming). Of course, this is after its all setup. And lastly, python is new and cool and stuff, along with linux(not so new, but still cool and stuff).

So those were our reason for trying the python/coprocessor technique.

Last edited by hdanak : 01-01-2008 at 21:09.
  #8   Spotlight this post!  
Unread 01-01-2008, 23:03
hdanak hdanak is offline
Registered User
FRC #2584 (Reseda Regents Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: California
Posts: 13
hdanak is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

I made an error on the previous post, calculating that python would be slower than the frc controller, forgetting that a 40mhz clock allows the FRC controller to run at 10mips (million instructions per second). So it will be faster with python, but not as fast as using C on the coprocessor (which would be an order of magnitude faster).
  #9   Spotlight this post!  
Unread 02-01-2008, 00:08
hdanak hdanak is offline
Registered User
FRC #2584 (Reseda Regents Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: California
Posts: 13
hdanak is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

Another question: where can we find sample code in Python (adambots reps are down). Thanks.
  #10   Spotlight this post!  
Unread 02-01-2008, 00:10
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: Programming in Python and Explaination of Programming

Even if it is alot faster to do calculations on a co processor, how fast can you pipe it back and forth between the two.. 115200kbs at most
  #11   Spotlight this post!  
Unread 02-01-2008, 00:28
hdanak hdanak is offline
Registered User
FRC #2584 (Reseda Regents Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: California
Posts: 13
hdanak is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

" The ACS communicates over serial using the
programming port on the IFI controller. During
normal operation, the IFI and the coprocessor
exchange data once every 26.2 ms, alternating
sending and receiving as the IFI receives new data.
" from Adambots kickoff presentation (http://www.chiefdelphi.com/media/papers/1900?)

well, that seems a bit slow (38 hertz), but i guess the program can be tweaked to go faster?
  #12   Spotlight this post!  
Unread 02-01-2008, 01:48
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Programming in Python and Explaination of Programming

38hz comes from the limitation on the IFI RC. The IFI only recieves new data from the OI every 26.6ms as well as updates pwms, unless I'm mistaken, and those are the points where their code has the IFI RC send the data over.
  #13   Spotlight this post!  
Unread 02-01-2008, 01:58
hdanak hdanak is offline
Registered User
FRC #2584 (Reseda Regents Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: California
Posts: 13
hdanak is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

I know its not the most reliable source, but according to IFI:
"Digital Input Frequency: 50 KHz (typical)"
and
"Serial Ports| TTL Serial (115Kb) and
RS232 Program (115Kb)"
(http://www.ifirobotics.com/rc.shtml)

so it looks like it could go at least some kilohertz there.
  #14   Spotlight this post!  
Unread 02-01-2008, 02:29
roboxking roboxking is offline
Registered User
AKA: Chris
FRC #2584 (Reseda Regent Robotics)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2006
Location: Encino
Posts: 4
roboxking is an unknown quantity at this point
Re: Programming in Python and Explaination of Programming

Thanks for all the information (and quick response) But now, I'm asking if anyone who has a [working] python code for an FRC robot? We need to see how one works, and etc. Thanks
  #15   Spotlight this post!  
Unread 02-01-2008, 08:28
jtdowney jtdowney is offline
Boiler Up
AKA: John Downey
FRC #4302 (Robophins)
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Chicago
Posts: 300
jtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant future
Re: Programming in Python and Explaination of Programming

I have seen the code for AdamBots (245) co-processor solution which uses Python. However as hdanak pointed out their bazaar repositories are not responding. You might try contacting them and seeing if they'd be willing to share the code with you.
__________________
John Downey
Lead Robot Inspector - Purdue IndianaFIRST District
Whitney Young Magnet High School/Robophins (FRC 4302) - Mentor (2013-current)
Midwest Regional Planning Committee - Member (2012-current)
Boilermaker Regional Planning Committee - Member (2011-2014)
Robot Inspector (2008-current)
Purdue FIRST Programs - Staff Advisor (2008-2011)
Lafayette-Jefferson High School/Precision Guessworks (FRC 1646) - Mentor (2006-2011)
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems programming knob and switch caderader Programming 4 16-02-2006 16:45
programming motors with programming kit BorisTheBlade FIRST Tech Challenge 4 01-11-2005 19:03
'Fix It Window' and Programming.... JMac Programming 19 25-01-2005 18:57
Problems and questions about programming hedgehogger Programming 4 15-01-2005 18:18
Programming and Electronics — Getting Started Sidney San Martín Technical Discussion 7 12-01-2005 15:25


All times are GMT -5. The time now is 12:10.

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