=====Communication Protocol===== \\ \\ An adoption of NMEA0183 (National Marine electronics Association) at RS-232 voltage levels is used for the data link between level 1 and level 2. The standard was chosen on the following basis: It has a low power consumption, the bandwidth requirements are low, it is human readable, and the signal can be tapped for easy debugging. Level 1 will once per second transmit a request for rudder and commands to the Level 2, in the form of a NMEA message. {{:l2-l1-comm.png?700|}} \\ There are three kind of NMEA-like messages involved for different communications: - Level 2 - Level 1 communication; - Level 1 - Operator bilateral communication. Level 2 sends messages to Level 1 containing the desired rudder angle and thruster intensity. These come as a result of high-level control (PIDs) implemented in DUNE. The format of this message is: \\ ;#; **MSG = BBB01 , RUD , THR , PWR_SETT , FALLB_MODE** ;#; Where:\\ - BBB01 is the msg ID; \\ - RUD is the rudder angle [-450,450]; \\ - THR is the thruster intensity [-100,100]; \\ - PWR_SETT are the power settings: 6-bits string where 1 disables and 0 enables; \\ - FALLB_MODE selects the fallback mode: 0 for //rudder 0//, 1 for //circle//, 2 for //autopilot//. \\ ============================================================================================================================= The operator can comminicate to Level 1 through Neptus (Java Plugin), sending messages that respect this format:\\ ;#; **MSG = RCC01 , RUD , THR , Kp , Ki , PWR_SETT , FALLB_MODE , MANUAL_CTRL** ;#; Where:\\ - RCC01 is the msg ID; \\ - RUD is the rudder angle [-450,450]; \\ - THR is the thruster intensity [-100,100]; \\ - Kp and Ki set the gains for the Level 1 //Fallback Autopilot//; \\ - PWR_SETT are the power settings: 6-bits string where 1 disables and 0 enables; \\ - FALLB_MODE selects the fallback mode: 0 for //rudder 0//, 1 for //circle//, 2 for //autopilot//; \\ - MANUAL_CTRL is a boolean: 1 for taking control (manual), 0 for giving control (autopilot). \\ ============================================================================================================================= Level 1 can send messages to the Operator showing the status of the system. These massage have the following format:\\ ;#; **MSG = CR601 , LEAK , PWR_SETT , LOAD, PANEL1_2 , BATT , COG , SOG , N_SAT , LAT , LONG , Kp , Ki , e , int_e , RUD , THRUST , L1_STATE , FALLB_MODE** ;#; Where:\\ - CR601 is the msg ID;\\ - LEAK indicates a leak is happening: 1 for TRUE, 0 for FALSE;\\ - PWR_SETT indicates the power settings: 6-bits string where 1 means disabled and 0 enabled; \\ - LOAD is the load power (W);\\ - PANEL1_2 is the panel 1 and panel 2 power (W);\\ - BATT is the voltage battery (V); \\ - COG is the course over ground (°); \\ - SOG is the speed over ground (kn); \\ - N_SAT is the satellites number used by the GPS; \\ - LAT is the latitude; \\ - LONG is the longitude; \\ - Kp and Ki are the gains used by the PI fallback autopilot controller; \\ - e is the error; \\ - int_e is the integrated error; \\ - RUD is the rudder computed by the PI fallback autopilot controller; \\ - THR is the thruster applied to the servo; \\ - L1_STATE shows the operating state of L1: 1 = normal, 2=fallback, 3=manual; \\ - FALLB_MODE selects the fallback mode: 0 for //rudder 0//, 1 for //circle//, 2 for //autopilot//.