Standards

Working with a bunch of instruments requires that different systems agree on some things. This is meant to be a comprehensive list of standards used in Zoidberg code.

Time stamps

A time stamp is simple a string that can be converted into a time. There are a lot of ways to do this.

from zoidberg.utils import timestamp print(timestamp())

An example timestamp is 19_073_16_37_35_996. This is read

  • Year
  • Julian day (day number out of 365/366)
  • Hour (out of 24)
  • Min
  • Sec
  • Milisec

File names

There will be a number of files automatically generated by zoidberg over the course of a mission. These files, for example camera stills, should be saved by timestamp name. Since there are both color and depth stills, these are designated with an additional string.

  • Camera still:img_19_073_16_37_35_996.jpeg
  • Depth still: depth_19_073_16_37_35_996.jpeg

Standard output string for an object dection

Vision will return this standard string for each object identified in an image. The sting will look like

img_19_067_11_50_05_560, 001, 463, 0432, 034, 056, 19_067_11_50_05_561

  • File name
  • Object ID
  • center_x
  • center_y
  • width
  • height
  • time stamp at the end of the image processing
"""
Standard output to use for testing mission

Each vision output will look like:

image_ID, object_ID, center_x, center_y, width, height, procssing_timestamp

Example Image
-----------> x
|  ..........................................
|  ..........................................
|  ..........................................
|  ..........................................
v  ...........<----w---->....................
y  ..........................................
    .......^...-----------....................
    .......|...|.........|....................
    .......h...|....C....|....................
    .......|...|.........|....................
    .......v...-----------....................
    ..........................................
    ..........................................

timestamp format: 19_067_11_50_05_561
year_JulianDay_Hour_Min_Sec_MS
"""


import time
import datetime
from zoidberg import utils

object_001 = ['001', '463', '0432', '034', '056']
object_002 = ['002', '023', '0123', '347', '021']
object_003 = ['003', '765', '1002', '745', '102']

# Each image will have a time based ID
image_ID = 'img_' + utils.timestamp()

def standard_output(detection_in):
    """Return up to three objects"""
    processing_timestamp = utils.timestamp()
    tstring = [image_timestamp] + detection_in + [processing_timestamp]
    detect_string = ", ".join(tstring)
    return detect_string

for ob in [object_001, object_002, object_003]:
    print(standard_output(ob))
    time.sleep(1)