Wifi fast.py

From DIDEAS Wiki
Revision as of 15:31, 22 September 2010 by Ceb (talk | contribs)
Jump to: navigation, search

wifi_fast.py is the primary utility for receiving real-time telemetry from the target. It makes connection to the target via either a standard RS-232 serial port, or via a TCP connection. Once connected it reads telemetry, can log the data to a file, and can send the data via UDP for real-time plotting. It also sends keyboard characters to the target which can then be read via the C function 'getchar'.

wifi_fast.py

  • get help with wifi_fast.py -h

The typical command contains 3 or 4 options as show below. wifi_fast.py -f log_file_name -V dataport3d -F -i IP_ADDRESS

The -V option specififes a "Vlist" or variable list that describes the binary format of the telemetry packet. These vlist files live in "support_scripts\vlist". Some times matching the vlist to the firmware can be a challege - as the two need to be precislty the same length; and the variable types must also match.

The -f option specifies the base name of the log file. As data is received, it converted as specified by the vlist, and stored in a self documenting .txt file that has a time stamp suffix. Several times an hour a new file will be started and the previous one added to a zip file.

The zip file often contains a file called "wifiload.m" that can be used with matlab to read the file and create a data structure with named fields. However, there are now easier to use matlab functions for this purpose.

via a wired connection

A wired ASYNC serial connection with the target requires a minimum of 3 wires : GND, Tx, Rx. The signals are 3.3V logical level. Several USB serial port devices called "PSER" have been made for this purpose. When connected to the PC, they will be assigned a "COMM PORT" number. Under windows you can use the "Device manager" to list the serial ports. You can run the command directly with the command "devmgmt"

via a wireless connection

The robot uses a "SWIFI" to make a connection to a 2.4Ghz "G" access point. The SWIFI needs to be pre-programmed to know what access point to connect to.

  • In lab the access point is : bmech4.media.mit.edu
    • You can also test connectivity with ping bmech4.media.mit.edu

From the support scripts folder run :

  • FOR S3 : wifi_fast.py -i 216 -F -f xx -V dataport
  • FOR S5 : wifi_fast.py -i 218 -F -f xx -V dataport

real_time plotting

reading txt data files with matlab

  • wifiload.m
  • data = wild(file_name_pattern)
  • obj = wild_cvt_dirlist(directory_pattern)

off line plotting data and objects