
PRO
dbeard
USA
Asked
— Edited

I need to understand what the following functions do and how to use them, they maybe just what I need. Can someone assist?
Where can I find more information on the following script functions. Specifically what they do and what the syntax looks like to use them.
Scientific Math Functions
Now()
Today()
DateTime Functions
MinDate()
MaxDate()
MonthName()
AddDays()
AddMonths()
AddYears()
AddHours()
AddMinute()
AddSeconds()
FmtNum()
FmtDate()
So we are kinda of talking about a Wiki where we could all or at least some use could add and edit content. We do that more or less here and many of contribute tutorials which are not in the Learn section. But I agree with the vib here, we something a little more.
I think those of that come from scripting and programming backgrounds have leg up because we already have experience under out belts. To bring that knowledge forward for others and make it "EZ" is a huge challenge.
Would EZ-Robot host some sort of Scripting Wiki where a counsel of volunteers members could have access to add and edit content? Maybe set some rules like a majority vote is required to add or edit content? EZ-Robot gets an overriding vote and edit control of course. Just tossing this idea out there.
JustinRatliff you've hit upon a great concept but WiKi control becomes the issue and EZ Robot may not have the staff to oversee the process.
A couple of years ago, before Revolution and all the tutorials, Josh Starnes was going to set up a Wiki, but he got busy with school. I think it is a great idea to have some method of having documentation in some kind of organized fashion. The forum is great, but it can take a while to find the right search terms to find a topic with an answer you are looking for and a lot of reading to determine if the answer is correct or not. The tutorials are great, but don't cover everything and not great as a reference you can refer back to over and over. Written documentation has been discussed many times with the main objection that DJ changes and adds to the software faster than he can document it (and his dyslexia makes it unlikely that he will write detailed documentation anyway). I think a community Wiki may be the best option if someone will step up to create and oversee it. I'll be happy to contribute and help edit, but I don't have the kind of time to offer right now to build it.
Alan
I just started another thread saying the same thing. Many of us know ZERO about programming. I am lucky I can get my computer to turn on! (Still trying to figure why I go to Start to shut it Off.... LOL) I just want a simple step by step format to learn how to script, with examples, and an explaination on how they work.
Example: 1) how to make a startup script to set servo home positions and zero sensors. Set maximum servo speeds to prevent damage to the robot parts. 2) run script examples. Show functions and a simple example on what they can do. ( how to call Auto Position functions and connect them to run a sequence, for example) 3) how to activate voice commands from a script. 4) More complex script functions have a special area of examples. 5) A format to build scripting from.
I know many people in this community already have examples of many of these scripts. A many of us new to scripting need is a place to see them and customize them to do what we want them to do. I know I would learn a lot easier that way.
Scripting For Dummies
Ron R
I've been making notes on some of this stuff for some time now. I thought I'd clean some of them up concerning the Science and Math functions. I'll have a look at the date-time functions next.
Scientific and Math Functions The following functions are used in the form of: $Variable =Function(Value)
Examples: $TheSine =Sin(2.5) $TheAngle =ASin($TheSine) $TheExp =Exp(1) $TheVal =Ciel(45.01) $TheVal =Pi()
They can also be used as intermediate values in script statements. Examples: $TheFinalVal =Sin(2.33)+Round(Floor($TheVal)) Print(" "+Sin(Abs($TheAngle))+" is the final value" )
Trig Functions (2pi Radians =360 degrees) 1 Rad =57.295779513 degrees
Sin(Angle in Radians) Sine function Sin(1) = 0.841471
Cos(Angle in Radians) Cosine function Cos(1) = 0.540302
Tan(Angle in Radians) Tangent Function Tan(1) = 1.557408
Sec(Angle in Radians) Secant function (reciprocal of the Cosine) Sec(1) = 1.850816
Csc(Angle in Radians) Cosecant function (reciprocal of the Sine) Csc(1) = 1.188395
Cot(Angle in Radians) Cotangent function (reciprocal of the Tangent) Cot(1) = 0.6420926
Hyperbolic functions SinH(Angle in Radians) Hyperbolic Sine function SinH(1) = 1.1752012
CosH(Angle in Radians) Hyperbolic Cosine function CosH(1) = 1.5430806
TanH(Angle in Radians) Hyperbolic Tangent function TanH(1) = 0.7615942
Inverse Functions Results are in Radians ASin(Sine of Angle) Arcsine function (Angle whose Sine is X) ASin(0.841471) = 1.00
ACos(Cosine of Angle) Arccosine function (Angle whose Cosine is X) ACos(00.540302) = 1.00
ATan(Tangent of Angle) Arctangent function (Angle whose Tangent is X) ATan(1.557408) = 1.00
Math Functions Abs(Number) Absolute Function - Returns number without sign Abs(-3.1416) = 3.1416 Abs(3.1416) = 3.1416 Abs(-2) = 2 Abs(2) = 2
Sqrt(Number) Square Root - Returns the square root of a number Sqrt(100) = 10 Sqrt(7.07) = 2.659 Sqrt(-5) =NaN =Not a Number - can't take square root of a negative
Ciel(Number) (Ceiling) Returns the smallest integer >= to a given number. Ciel(8) = 8 Ciel(8.001) = 9 Ciel(45) = 45 Ciel(-45) = -45 Ciel(45.001) = 46 Ciel(-45.001) = -45 Ciel(45.95) = 46 Ciel(-45.95) = -45
Floor(Number) Returns the largest integer <= a given number. Floor(8) = 8 Floor(8.001) = 8 Floor(8.9) = 8 Floor(45) = 45 Floor(-45) = -45 Floor(45.001) = 45 Floor(-45.001) = -46 Floor(45.95) = 45 Floor(-45.95) = -46
Exp(Number) Returns e to the x power. e = Euler's constant (~2.718282) Exp(-1) = 0.367879 Exp(0.95) = 2.5857 Exp(1) = 2.718282 Exp(0) = 1
Log10(Number) Returns Log-base10 Log10(2) = 0.30103 Log10(20) = 1.30103 Log10(1) = 0 Log10(10) = 1 Log10(100) = 2 Log10(1000) = 3 Log10(0) = -Infinity Log10(-2) = NaN = Not a Number (Invalid)
Log(Number) Returns the natural log function (base e) Log(1) = 0 Log(10)= 2.3025851 Log(-1) = NaN =Not a Number (out of range) Log(0) = -Infinity
Max(Number1, Number2) returns the largest of 2 numbers Max(1,2) = 2 Max(-1, -2) = -1 Max(-10,20) = 20 Max(1,2,3,4,5) = 2 - Anything beyond 2 numbers is ignored Max(1) =Error - Must have at least 2 values Max() = Error
Min(Number1, Number2) returns the smallest of 2 numbers Min(1,2) = 1 Min(-1, -2) = -2 Min(-10,20) = -10 Min(1,2,3,4,5) = 1 - Anything beyond 2 numbers is ignored Min(1) =Error - Must have at least 2 values Min() = Error
Round(Number) Returns the value of a number rounded to the nearest integer Round(1.25) = 1 Round(1.49) = 1 Round(1.5) = 2 Round(1) = 1 Round(-1.25) = -1 Round(-1.5) = -2
E() returns the value of e E() = 2.718281828459045
Pi() Returns the value of pi Pi() =3.14159265358979
WBS00001 thanks a lot for posting your summary of Scientific and Math Functions. I guess for now I'm going to copy and paste into a word doc until I get enough really good examples that will make some sense and become a great memory jogger.
OK, that just gave me a headache.
@Robot-Doc You're welcome. You might want to copy and paste it all again since I just found (and corrected) a couple of errors.
@DaveSchulpius Hmmm. Maybe I should put in a picture of a couple of aspirins at the end for just such maladies.