Go to Post I never said there was anything wrong with the kit frame, simply that it was weak. - Viper37 [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 06-06-2010, 15:56
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Using A Scripting Language To Script Robot Behaviour

I am working on porting a LOLCODE scripting engine for use in autonomous
  #2   Spotlight this post!  
Unread 06-06-2010, 19:48
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,524
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

To the original poster,

A so-called scripting language is really just another layer of abstraction between the user and the robot.

Why would you want to take a robot that could be programmed in C and C++, two of the most widely-known programming languages there are, and add another layer of complexity along with the potential of another set of errors?

You can do the exact same thing in C in the way it was given to you with call-able subroutines, procedures, and classes that make it easy to program autonomous.

In fact, that's a large part of what has already been done for you with the different libraries provided.

Then, not only do people have an environment to work in that they are familiar with, they can go and look at the C-code and modify it directly, without all the extra headaches that go along with an un-needed additional layer of code.

What benefit is gained by using an additional langauge and layer of complexity that cannot already be gained by clean and concise C programming?
  #3   Spotlight this post!  
Unread 06-06-2010, 21:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

My input would be to focus on the core libs. You can start with simple C/C++ code to sequence through core routines and test the initial autonomous.

Once you have that under your belt, you want a way to safely and quickly write alternative auto routines. If you don't want much flexibility, you simply make it data driven using XML or another text format, or even Excel or other spreadsheet. If you want to be able to loop and make decisions, these lack enough flexibility, so you pull in a safe high-level language.

If you don't get the core stuff done, you'll find yourself writing too much code in the scripting language, which will hurt the performance and will turn difficult since scripting languages typically run into issues doing low level stuff.

Greg McKaskle
  #4   Spotlight this post!  
Unread 06-06-2010, 21:47
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,524
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Exactly.

In fact, if you want easily changed code, it's easy enough to read waypoints or other direction and distance data from a text file on execution of the code. Then changing behavior is as simple as modifying a text file of waypoints or something to that effect.
  #5   Spotlight this post!  
Unread 07-06-2010, 11:24
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,674
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

The basic need for scripting in a large integrated system comes from the need to reload non-core files without having to reboot due to relatively long reboot times (even 30 seconds is too long in some cases). Configurations are typically done in xml or some othe proprietary format, whereas procedures are typically done with shell scripts. It also allows for an adhoc content management setup so that a single link points to the current script file to use when there are multiple options/versions available. Changing the link (manually or automatically via code) changes which script a procedure points to. The nifty thing about this is that it allows for bug fixes post-deployment, yet remember we're talking about large software systems here...systems that may run on the stock market, large multi-manned vehicles, satellites, etc.

An architecture for a robot is easily extracted from this setup, yet there must be a core process that runs and calls the scripts continuously. Race conditions must be accounted for, as well as file I/O issues such as stale handles to files that were deleted/replaced.

It seems trivial and easy, yet the reality is that scripting in such a way will cost more overhead that it's worth for most typical robots. You would need an engine to handle the scripting, file I/O, and robot control all at once. While I agree that a gaming engine is the closest neighbor to that requirement, a typical robot processor (particularly an isolated, remote autonomous robot) does not have the juice or power longevity to support it. FRC robots may have the processing power to handle it, but do not nearly have the necessity for it given all of the matured development tools.
__________________

Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub

Last edited by JesseK : 07-06-2010 at 11:30.
  #6   Spotlight this post!  
Unread 07-06-2010, 22:38
StevenB StevenB is offline
is having FRC withdrawal symptoms.
AKA: Steven Bell
no team
Team Role: College Student
 
Join Date: May 2005
Rookie Year: 2005
Location: Stanford, CA
Posts: 413
StevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond reputeStevenB has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Quote:
Originally Posted by Tom Line View Post
Why would you want to take a robot that could be programmed in C and C++, two of the most widely-known programming languages there are, and add another layer of complexity along with the potential of another set of errors?
Try asking that to the developers of Python, Ruby, MATLAB, PHP, Tcl, Perl, JavaScript, and Lisp. Why? Because its faster and easier to develop code in a scripting language. I would love to ssh into the robot, open a python shell, and start hacking away. I don't have to recompile and download my code each time, I don't have to mess around with a C/C++ debugger, and I can even experiment with things interactively.
Don't get me wrong, I like C/C++, and Java too. I grew up with them, programmed more than a few robots with them, and learned a ton. I'm using both in my current job. GDB and other debugging tools are great, but they can't beat MATLAB for ease of debugging. There's something about the ease of scripting languages that makes programming fun. Controlling a LEGO Mindstorms robot with Python is a blast; I can only imagine the fun we could have in FRC.

All that said, I'm not sure if the CRIO is ripe for scripting. The thing that makes Python (and PHP and MATLAB) so easy is that there are tons of libraries available only an command away. A language written from scratch wouldn't have the power that these do. Porting an existing interpreter is an even larger amount of work, and for the near term, using C/C++ is a lot easier. As others have said, it's possible to write a good code base so that the C++ you have to work with is more like scripting.
__________________
Need a physics refresher? Want to know if that motor is big enough for your arm? A FIRST Encounter with Physics

2005-2007: Student | Team #1519, Mechanical Mayhem | Milford, NH
2008-2011: Mentor | Team #2359, RoboLobos | Edmond, OK
2014-??: Mentor | Looking for a team...
  #7   Spotlight this post!  
Unread 08-06-2010, 08:20
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,935
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Quote:
Originally Posted by StevenB View Post
Try asking that to the developers of Python, Ruby, MATLAB, PHP, Tcl, Perl, JavaScript, and Lisp. Why? Because its faster and easier to develop code in a scripting language...
Let's all remember that there are some tasks well suited to opening "a Python shell, and start hacking away.", and there are others which absolutely are not.

Getting an FRC robot onto Einstein might be one that is, or it might not.

Don't get me wrong - I do plenty of hacking. Saying that hacking is bad is not my point.

Here is what I suggest you focus on: A good programmer will know how to succeed at both styles of coding, and will be wise enough to know the differences between them, and to know when each is appropriate/useful.

Students - Learn enough about both styles, and be comfortable in either.

An FRC robot can be a useful place to learn about either approach. Both approaches have advantages; and it is a sign of wisdom to be able to see past slogans and superficial differences when talking about either.

Blake
PS: So - What is a time when hacking away in a scripting language, is absolutely not the right approach? How about when my life is on the line in an airplane that uses the resulting code. What about in an FRC robot? Maybe. Assess and balance the risks and the rewards.
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate

Last edited by gblake : 08-06-2010 at 08:24.
  #8   Spotlight this post!  
Unread 08-06-2010, 08:41
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,086
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Quote:
Originally Posted by gblake View Post
What is a time when hacking away in a scripting language, is absolutely not the right approach? How about when my life is on the line in an airplane that uses the resulting code.
Another example would be automotive smart actuators, but for a different reason: with the high volumes, pennies matter. Coaxing the required performance out of an inexpensive microcontroller often means you can't even afford the overhead of a commercial RTOS, let alone an interpreter. Coding for such an environment requires a unique set of skills.
  #9   Spotlight this post!  
Unread 08-06-2010, 09:46
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,280
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Quote:
Originally Posted by Ether View Post
Another example would be automotive smart actuators, but for a different reason: with the high volumes, pennies matter. Coaxing the required performance out of an inexpensive microcontroller often means you can't even afford the overhead of a commercial RTOS, let alone an interpreter. Coding for such an environment requires a unique set of skills.
This applies to nearly any consumer electronic device. I can tell you for a fact that there are almost no mass produced toys that are coded in a scripting language.
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #10   Spotlight this post!  
Unread 08-06-2010, 10:42
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,393
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

TomLine has had the best set of comments about scripting. In my world I program at five different levels:

Bare metal - This is low level microprocessor code, it's running on the processor there is no OS involved. I program in C so the steps are compile, download, test. But I have a PIC development environment so I can also do some interactive debugging on my desk before I download code to the hardware.

Robot code on the cRio - Low level code, while there is a kernel OS running, the system needs to be restarted to test. So the code cycle is the same as bare metal

Code on an OS that needs to be restarted - Java and C where the application needs to be stopped and restarted. There is a huge selection of tools that can be used to develop with interactive debuggers to make the development process much faster

Code on an OS that does not need to be restarted - The land of scripts. There is a interpreter process that runs all the time processing the script. When there is new production code the interpreter process is directed to the new script and it runs that. I program mostly in TCL for that environment.

Programs that do X out of the box, but I need to extend the functions. In most cases the company has allowed me to call some "scripting language" from points in their product. For example the proxy server I use allows me to call Lua code to do specific processing of a message. The short fragments allow me to have custom code without rewriting the entire product.

Some of the "faster in scripts" has to do with the functions built into the scripting language or libraries, not with the code. Perl and TCL have some great array and string functions built in so there is less code to write. But there are great Java and C libraries that you can use so the code effort is almost the same.

The key difference in my world is that we use a structured methodology to programming. Analysis, design, code, test, implement. Half the time in analysis and design, 1/4 in code, 1/3 in test. Always the same, C, Java, TCL, Lua. Now there are mentions to "hacking away", just jumping in and cutting code. And those people will take more time because they are not doing the analysis and design up front, they do it and re do it as they go. So there is a good deal of rework as they go along.

But because it's ongoing code, test, code, test, they don't see the embedded analysis and design time. (And I'm a big fan of agile methods (I'm a certified Scrum master) but there is analysis and design going on)

Blake makes a good point about "hacking away" and safety. Not on his plane, maybe on the robot if he's out of the way. Nothing to do with the "language" in use. I can write equally good code in C or TCL, the testing process is what makes the difference.

Greg McKaskle makes a good point to start with the core C calls. If I was going to do your project I would pick a scripting language that can be embedded in a C program (like TCL) or Java (like Lua). I'd build the core infrastructure (API calls) that runs the motors and IO ports and let them be called by the scripting language. Make a way to stop and restart the core program externally so the script can be changed.

My big points are:
* Planned code development isn't that much different from language to language.
* Ad hoc development (hacking) is fine if you don't need to depend on the results.
* Scripting is attractive to our robot worlds IF it would end the long compile / reboot cycles.
* There is no silver bullet. (The Lone Ranger is an actor with a mask)

Keep us posted on how your scripting kernel works out.
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.
  #11   Spotlight this post!  
Unread 13-06-2010, 21:15
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,935
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Quote:
Originally Posted by apalrd View Post
...
Using a scripting language in this case would allow the programmer to modify autonomous variables quickly and save the .xml file to the filesystem, eliminating the need for compiling, downloading, and rebooting to make small auto changes.
...
That's not all a scripting language will let you do. It will also let you quickly introduce mistaeks.

Quote:
Originally Posted by gblake View Post
...
A good programmer will know how to succeed at both styles of coding, and will be wise enough to know the differences between them, and to know when each is appropriate/useful.
...
I'm still not saying either method is "the best". I am suggesting that you think carefully before using scripting in a high-pressure environment without also implementing some error-checking that can be executed before putting the robot on the real field.

Blake
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate

Last edited by gblake : 13-06-2010 at 22:00.
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
Trailer Behaviour Wetzel Chit-Chat 3 11-01-2009 11:39
Erratic Keyboard Behaviour Andrew Blair Chit-Chat 9 15-11-2006 07:49
Erratic Keyboard Behaviour Andrew Blair Technical Discussion 3 12-11-2006 14:34
2005 scripting language? rjwalters Programming 1 02-02-2005 18:44
TI programming using Z80 assembly language Jeff Wong Chit-Chat 1 07-06-2001 01:27


All times are GMT -5. The time now is 07:25.

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