Communication

The follwoing describes the methods used to esablish communication links. There are two ways to establish a connection, serial or WiFi using UDP protocol.

Serial Connection

set_COMPORT

This method sets the serial COM port property COM. In Windows, it is usally named COM#, e.g. 'COM7'. In Mac OS, it is usually named /dev/ttyusbserialxx..

  • Syntax:
    obj.set_COMPORT('<port name>');
    
  • Example:
    obj.set_COMPORT('COM7');
    % or in Mac
    obj.set_COMPORT('/dev/ttyusbserial0');
    
findPorts

Lists available serial ports to connect to.

  • Syntax:
    obj.findPorts();
    
  • Example output:
    obj.findPorts();
    'COM1'
    'COM2'
    
set_BAUDRATE

Sets the baud rate property BAUD of the serial port defined in COM.

  • Syntax:
    obj.set_BAUDRATE(<baud rate>);
    
  • Example:
    % baud rates examples: 9600, 57600, 115200, up to 921600
    obj.set_BAUDRATE(57600);
    
ConnectSerial

Connects to the serial port defined by COM and BAUD.

  • Syntax:
    obj.ConnectSerial();
    

WiFi Connection (via UDP)

set_UDPLOCALPRT

Sets the local UDP port property udp_localPort. The port should be available and not used by other tasks in the system.

  • Syntax:
    obj.set_UDPLOCALPRT(<local port>);
    
  • Example:
    % Listens on port 14550
    obj.set_UDPLOCALPRT(14550);
    
set_UDPREMOTEADDR

Sets UDP remote address property UDP_dest for particular target. It needs the target system and remote address as two inputs.

  • Syntax:
    obj.set_UDPREMOTEADDR(<target>, {<'remote IP'>, <remote port>});
    
  • Example:
    % Identify  target 1 by IP 192.168.1.1 on port 14551
    obj.set_UDPREMOTEADDR(1, {'192.168.1.1 ', 14551});
    
ConnectUDP

Creates local ports defined in udp_localPort and listens on it.

  • Syntax:
    obj.ConnectUDP();
    

Note: you can just use:

obj.set_UDPLOCALPRT(14550);
obj.ConnectUDP();

MATMAV will detect Mavs automatically once they are connected to the selected port (in this case 14550)

results matching ""

    No results matching ""