and 1 contributors
- THE USE OF YAML FILES
- LIST OF FUNCTIONS
- start_for($var, init => $init, end => $end, )
- int var(name => $name, value => $value)
- char var(name => $name, value => $value)
- long var(name => $name, value => $value)
- battery(name => $variable_name)
- kill(task => $any_function)
- sound(freq => $frequency, dur => $duration)
- tone(tone => "beep")
- sound_power(bool => "true")
- pragma(in => 2, name => $name, type => "Touch")
- reflect(port => 2, bool => "true")
- auto(bool => "true")
- inc_plus( $var )
- inc_minus( $var )
- motor(port => 2, speed => $speed)
- speed_up(port => 2, speed => $increment)
- time_while($what_time_to_stop, )
- cont(port => 2, channel => 2)
- THESE FUNCTIONS SHOULD BE USED AS VALUES
RobotC-Wrapper - An easy to read, fully functional RobotC for Vex wrapper.
#!/usr/bin/perl -w use strict; use RobotC::Wrapper; use RobotC::Wrapper::Utils; my $SV = "SensorValue"; my $u = RobotC::Wrapper::Utils->new( config => "/home/jbert/path/to/data.yaml" ); $u->basic_movements; my $r = RobotC::Wrapper->new; $r->start_void("function_name"); $r->motor(1, 127); $r->motor(2, 127); $r->end;
The RobotC::Wrapper base library has a series of functions that you can call which will spit out RobotC. Start by initiating it. use RobotC::Wrapper; my $r = RobotC::Wrapper->new()
When the constuctor is initiated, a config file (yaml file) must be defined as seen aboved. If the path is not defined, an error will occur and compilation will fail. The yaml file should be formatted as such: --- motor_port: right: left: 2: 3: 4: 5: channel: 0: 1: 2: 3: 4: 5: speed: forward: reverse: stopped: auto: state: reflect: state: port: All values are inputted by the user (the only user input the program takes).
Starts a void function. $name is the name of the function being declared.
Starts the main task. This function must always be present while using RobotC-Wrapper.
Starts an if statement. $condition is, of course, the condition.
Starts an elseif startement.
Starts a for loop. Takes three arguments: the var to increment, a start value ( usually 0 ), and an end value,
Starts a while loop. Takes the condition.
Prints a brace "}" and starts a newline.
Declares a new integer variable
Declares a new char variable
Declares a new long integer variable
Declares a variable containing the current battery level, takes the variable name as the only argument.
Kills the function specified as a parameter.
Turns off all tones and sounds.
Plays a tone, takes two arguments: frequency, and duration.
Plays tone, takes one parameter: must be "buzz", "beep", or "click".
Turns sound on and off, true or false as a parameter.
Starts an if statement with a predeclared condition (if sound is available).
Does the same thing as if_sound, but checks for controller activity.
Sets up sensors. Should be the first thing called after start_robot. Takes three parameters: in port, name, and sensor type ("Touch, SONAR, etc").
Reflects a designated port, takes two parameters: port name ( "port2", "port3", etc ), and boolean ( most likely true ).
Toggles autonomous mode depending on the boolean parameter.
increments a variable plus one ($var++)
same as inc_plus but minus ($var--)
Sets motor value, takes two parameters: port name and speed ( -127 - 127 ).
Speeds up to motors, takes two arguments: port name, and a number to be added to the current speed.
Clears and starts a timer.
Takes one argument: a time limit which makes the condition false.
Pauses the robot for the given amount of seconds. ( yes, SECONDS! )
Denotes a given motor port to a transmitter channel.
Calls a given function.
Equal to the cosine of $var.
Equal to the sin of var.
Equal to the tangent of $var.
Converts parameter from degrees to radians
Converts parameter from radians to degrees
James Albert <email@example.com> Casey Vega <firstname.lastname@example.org>