modules: commander: Implement arm authorization request

If the second bit of COM_ARM_MIS_EXT_REQ is set the vehicle
will only arm after receive an authorization.

The authorization flow:
vehicle/external -> command: arm authorization request -> arm authorizer
vehicle <- command ack with result in progress <- arm authorizer
vehicle <- any data request <- arm authorizer
vehicle -> data response -> arm authorizer
vehicle <- command ack authorizing or denying <- arm authorizer

Right now there is 2 ways to start the arm authorization request,
that can be configured by COM_ARM_AUTH parameter.
- One arm: When pilot request the vehicle to arm, it will request
authorization blocking the arm process up to the timeout defined in
COM_ARM_AUTH parameter.
- Two arms request: The first arm request will request the
authorization and will deny the first arm request, if authorizer
approved the request, pilot can arm again within the authorized
time and arm without any block.

The arm authorizer can be running anywhere(compute board or PX4
itself) and it is responsible to request the mission list or any
other information to vehicle before send a final response, it
should send to vehicle a COMMAND_ACK with
result = MAV_RESULT_IN_PROGRESS as soon as it receive the arm
authorization request and the final result
as after it got all the data that it needs authorize or deny the
request.
This commit is contained in:
José Roberto de Souza
2017-08-28 08:28:57 +02:00
committed by Lorenz Meier
parent 66170d1c01
commit 3fd7e3f89c
7 changed files with 359 additions and 0 deletions
+17
View File
@@ -620,3 +620,20 @@ PARAM_DEFINE_INT32(COM_ARM_MIS_REQ, 0);
* @group Mission
*/
PARAM_DEFINE_INT32(COM_POSCTL_NAVL, 0);
/**
* Arm authorization parameters, this uint32_t will be splitted between starting from the LSB:
* - 8bits to authorizer system id
* - 16bits to authentication method parameter, this will be used to store a timeout for the first 2 methods but can be used to another parameter for other new authentication methods.
* - 7bits to authentication method
* - one arm = 0
* - two step arm = 1
* * the MSB bit is not used to avoid problems in the conversion between int and uint
*
* Default value: (10 << 0 | 1000 << 8 | 0 << 24) = 256010
* - authorizer system id = 10
* - authentication method parameter = 10000msec of timeout
* - authentication method = during arm
* @group Commander
*/
PARAM_DEFINE_INT32(COM_ARM_AUTH, 256010);