UAV::Pilot::Wumpus::Server
my $backend = UAV::Pilot::Wumpus::Server::Backend::RaspberryPiI2C->new; my $server = UAV::Pilot::Wumpus::Server->new({ backend => $backend, packet_callback => sub { my ($server, $packet) = @_; ... }, }); $server->start_listen_loop;
A server for running the Wumpus. Listens on specified UDP port, defaulting to <UAV::Pilot::Wumpus-DEFAULT_PORT>>.
<UAV::Pilot::Wumpus-
new({ ... packet_callback => sub { my ($server, $packet) = @_; ... }, });
An optional callback function that will get every packet from the first StartupRequest onward. This will be called after the Backend has processed the packet.
It is passed the UAV::Pilot::Wumpus::Server object and the packet. The return value is ignored.
Starts listening on the UDP port. Loops indefinitely.
process_packet( $packet )
Does the right thing with $packet (a UAV::Pilot::Wumpus::Packet object).
$packet
UAV::Pilot::Wumpus::Packet
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.
Sets the raw min/max value for the associated channel number. Channels are numbered 1 through 8.
_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.
$in_max - $in_min == 0
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.
On Raspbian, follow the instructions below for installing the Raspicam v4l driver:
http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=16
To install UAV::Pilot::Wumpus::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UAV::Pilot::Wumpus::Server
CPAN shell
perl -MCPAN -e shell install UAV::Pilot::Wumpus::Server
For more information on module installation, please visit the detailed CPAN module installation guide.