NAME

RobotC-Wrapper - An easy to read, fully functional RobotC for Vex wrapper.

SYNOPSIS

#!/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;

DESCRIPTION

RobotC::Wrapper

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()

THE USE OF YAML FILES

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).

LIST OF FUNCTIONS

start_void($name)

Starts a void function. $name is the name of the function being declared.

start_task()

Starts the main task. This function must always be present while using RobotC-Wrapper.

start_if($condition)

Starts an if statement. $condition is, of course, the condition.

start_else_if($condition)

Starts an elseif startement.

start_for($var, init => $init, end => $end, )

Starts a for loop. Takes three arguments: the var to increment, a start value ( usually 0 ), and an end value,

start_while($condition)

Starts a while loop. Takes the condition.

end()

Prints a brace "}" and starts a newline.

int var(name => $name, value => $value)

Declares a new integer variable

char var(name => $name, value => $value)

Declares a new char variable

long var(name => $name, value => $value)

Declares a new long integer variable

battery(name => $variable_name)

Declares a variable containing the current battery level, takes the variable
name as the only argument.

kill(task => $any_function)

Kills the function specified as a parameter.

mute()

Turns off all tones and sounds.

sound(freq => $frequency, dur => $duration)

Plays a tone, takes two arguments: frequency, and duration.

tone(tone => "beep")

Plays tone, takes one parameter: must be "buzz", "beep", or "click".

sound_power(bool => "true")

Turns sound on and off, true or false as a parameter.

if_sound()

Starts an if statement with a predeclared condition (if sound is available).

if_active()

Does the same thing as if_sound, but checks for controller activity.

pragma(in => 2, name => $name, type => "Touch")

Sets up sensors. Should be the first thing called after start_robot.
Takes three parameters: in port, name, and sensor type ("Touch, SONAR, etc").

reflect(port => 2, bool => "true")

Reflects a designated port, takes two parameters: port name ( "port2", "port3", etc ), and boolean ( most likely true ).

auto(bool => "true")

Toggles autonomous mode depending on the boolean parameter.

inc_plus( $var )

increments a variable plus one ($var++)

inc_minus( $var )

same as inc_plus but minus ($var--)

motor(port => 2, speed => $speed)

Sets motor value, takes two parameters: port name and speed ( -127 - 127 ).

speed_up(port => 2, speed => $increment)

Speeds up to motors, takes two arguments: port name, and a number to be added to the current speed.

clear_time()

Clears and starts a timer.

time_while($what_time_to_stop, )

Takes one argument: a time limit which makes the condition false.

wait($duration)

Pauses the robot for the given amount of seconds. ( yes, SECONDS! )

cont(port => 2, channel => 2)

Denotes a given motor port to a transmitter channel.

call($function_name)

Calls a given function.

THESE FUNCTIONS SHOULD BE USED AS VALUES

cos($var)

Equal to the cosine of $var.

sin($var)

Equal to the sin of var.

tan($var)

Equal to the tangent of $var.

d_r($var)

Converts parameter from degrees to radians

r_d($var)

Converts parameter from radians to degrees

AUTHORS

James Albert <james.albert72@gmail.com>
Casey Vega   <casey.vega@gmail.com>