Manages sending the picpilot commands. Writes to the data relay connection to send commands. Validates data before sending it out using the Validator module.
- Copyright:
-
- Waterloo Aerial Robotics Group 2016
- Source:
- See:
Requires
- module:util/Validator
- module:SimulationManager
- module:util/Logger
- module:Network
- module:config/picpilot-config
Methods
-
<inner> activateWriteMode()
-
Actives write mode for the groundstation, allowing the groundstation to send commands that affect the autopilot
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> appendWaypoint(lat, lon, alt, radius, probe_drop)
-
Appends a waypoint to the autopilots flight plan
Parameters:
Name Type Description latstring | Number Latitude of waypoint
lonstring | Number Longitude of waypoint
altstring | Number Altitude of waypoint
radiusstring | Number Radius, in m, of the waypoint
probe_dropboolean Whether the waypoint is a probe drop location
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> armPlane()
-
Arms the plane
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> checkConnection()
-
Checks whether there is an active data relay connection
- Source:
Returns:
Connection status
- Type
- boolean
-
<inner> clearWaypoints()
-
Clears all the waypoints for the path manager
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> disarmPlane()
-
Disarms the plane
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> dropProbe(number)
-
Drop a probe
Parameters:
Name Type Description numberstring | Number The probe number of which to drop
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> followPath(status)
-
Tell the aircraft to follow the flight plan
Parameters:
Name Type Description statusboolean Whether the plane should follow the flight plan
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> insertWaypoint(index, lat, lon, alt, radius)
-
Inserts a waypoint at a specified index to the autopilot's flight plan
Parameters:
Name Type Description indexint The index of the waypoint
latstring | Number Latitude of waypoint
lonstring | Number Longitude of waypoint
altstring | Number Altitude of waypoint
radiusstring | Number Radius, in m, of the waypoint
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> insertWaypoint(index, lat, lon, alt, radius, probe_drop)
-
Inserts a waypoint at a specified index to the autopilot's flight plan
Parameters:
Name Type Description indexint The index of the waypoint
latstring | Number Latitude of waypoint
lonstring | Number Longitude of waypoint
altstring | Number Altitude of waypoint
radiusstring | Number Radius, in m, of the waypoint
probe_dropboolean Whether the waypoint is a probe drop location
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> killPlane()
-
Kills the plane
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> removeWaypoint(index)
-
Removes a waypoint from the autopilot's flight plan
Parameters:
Name Type Description indexString | Number The id of the waypoint
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> resetProbe(number)
-
Reset a probe
Parameters:
Name Type Description numberstring | Number The probe number of which to drop
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendAltitude(altitude)
-
Sends a altitude value to the autopilot
Parameters:
Name Type Description altitudestring | Number The altitude in m
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendAutoLevel(level)
-
Sends an autonomous level to the picpilot. Check the datalink docs for more info
Parameters:
Name Type Description levelstring | Number The autonomous level as a decimal value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendCommand(command, value)
-
Sends a regular command to the data relay
Parameters:
Name Type Description commandstring The command name
valuestring | Number The value of the command. This can be lots of different parameters
- Source:
Returns:
Whether the command was successfully sent. Will return false if there is no connection and the simulator isn't active
- Type
- boolean
Example
Commands.sendCommand('awesomeCommand', 'value1', 'value2', 'value3'); //will send this through the data relay //awesomeCommand:value1, value2, value3 -
<inner> sendFlap(flap)
-
Sends a flap value to the autopilot
Parameters:
Name Type Description flapstring | Number The flap percentage (0 is no flaps, 100% is full flaps)
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendHeading(heading)
-
Sends a heading value to the autopilot
Parameters:
Name Type Description headingstring | Number The heading in degrees (0-360)
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendHeartbeat()
-
Send a heartbeat to the plane
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendKDGain(type, gain)
-
Sends a kd gain value to the autopilot
Parameters:
Name Type Description typestring One of:
flap,altitude,throttle,heading,roll,pitch,yawgainstring | Number The gain value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendKIGain(type, gain)
-
Sends a ki gain value to the autopilot
Parameters:
Name Type Description typestring One of:
flap,altitude,throttle,heading,roll,pitch,yawgainstring | Number The gain value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendKPGain(type, gain)
-
Sends a kp gain value to the autopilot
Parameters:
Name Type Description typestring One of:
flap,altitude,throttle,heading,roll,pitch,yawgainstring | Number The gain value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendOrbitGain(gain)
-
Sends a orbital gain value to the autopilot
Parameters:
Name Type Description gainstring | Number The gain value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendPathGain(gain)
-
Sends a path gain value to the autopilot
Parameters:
Name Type Description gainstring | Number The gain value
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendPitch(pitch)
-
Sends a pitch value to the autopilot
Parameters:
Name Type Description pitchstring | Number The pitch in degrees
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendProtectedCommand(command)
-
Sends a protected command (a command requiring a password appended after the command)
Parameters:
Name Type Description commandstring - Source:
Returns:
Whether the command was successfully sent. Will return false if there is no connection and the simulator isn't active
- Type
- boolean
-
<inner> sendRawCommand(command)
-
Sends a raw command (no formatting) to the data relay
Parameters:
Name Type Description commandstring The command string
- Source:
Returns:
Whether the command was successfully sent. Will return false if there is no connection and the simulator isn't active
- Type
- boolean
-
<inner> sendRoll(roll)
-
Sends a roll value to the autopilot
Parameters:
Name Type Description rollstring | Number The roll in degrees
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> sendThrottle(throttle)
-
Sends a throttle value to the autopilot
Parameters:
Name Type Description throttlestring | Number The percentage value of the throttle
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> setTargetWaypoint(number)
-
Sets the target waypoint for the autopilot's path manager
Parameters:
Name Type Description numberString | Number The id of the waypoint
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean
-
<inner> unkillPlane()
-
Unkills the plane
- Source:
Returns:
Whether the command sent successfully
- Type
- boolean