Timm Murray > UAV-Pilot-0.8 > UAV::Pilot::WumpusRover::Server

Download:
UAV-Pilot-0.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  2
View/Report Bugs
Source  

NAME ^

    UAV::Pilot::WumpusRover::Server

SYNOPSIS ^

    my $backend = UAV::Pilot::WumpusRover::Server::Backend::RaspberryPiI2C->new;
    my $server = UAV::Pilot::WumpusRover::Server->new({
        backend => $backend,
    });
    $server->start_listen_loop;

DESCRIPTION ^

A server for running the WumpusRover. Listens on specified UDP port, defaulting to <UAV::Pilot::WumpusRover-DEFAULT_PORT>>.

METHODS ^

start_listen_loop

Starts listening on the UDP port. Loops indefinitely.

process_packet

    process_packet( $packet )

Does the right thing with $packet (a UAV::Pilot::WumpusRover::Packet object).

ch*_min() and ch*_max()

The channel min/max values that you can set. Channels are numbered 1 through 8.

Note that these are the min/max values that are input to the server. The values output by the backend is set by the backend.

PROTECTED METHODS ^

_set_ch*_min( $value ) and _set_ch*_max( $value )

Sets the raw min/max value for the associated channel number. Channels are numbered 1 through 8.

_map_value

    _map_value(
        $in_min, $in_max,
        $out_min, $out_max,
        $input,
    )

Given the input min/max settings, maps the input number to an equivalent output between the output min/max. For instance:

    $self->_map_value(
        0, 10,
        0, 30,
        5,
    );

Would return 15.

Note that this returns 0 if $in_max - $in_min == 0, which avoids a divide-by-zero error. This isn't correct behavior and will be fixed Soon(tm). The output min/max settings don't have this problem.

The primary use of this method is for backends to map the channel values held by the Server object into the output needed by the backend connection.

syntax highlighting: