[[Include(WikiToC)]]
=== Service: XY Table
 [[Image(xy_table.JPG, 300px)]]
This service is used to control the positioning of the [wiki:Hardware/SubSystems/Sivers Sivers 60 GHz] antenna arrays mounted on the XY-tables in [wiki:Architecture/Domains/cosmos_sb1 COSMOS Sandbox 1]. The XY tables allow for independent movement of each antenna array in the horizontal plane within a 1.3m x 1.3m area, as well as rotating the arrays +/-45° about their vertical axis.
XY Tables:
 ||= '''Name''' =||= '''Location''' =||= Mounted Device =||
 ||  xytable1.sb1.cosmos-lab.org  ||  COSMOS Sandbox 1  ||  rfdev3-5  ||
 ||  xytable2.sb1.cosmos-lab.org  ||  COSMOS Sandbox 1  ||  rfdev3-6  ||
Overhead View (''not to scale''):
 [[Image(xy_overhead_diagram.png, 800px)]]
Useful usage notes:
* X,Y movement is limited within a 1.3m x 1.3m area.
* The antenna arrays may be rotated +/-45° about their vertical axis.
* The centers of the tables are approximately 20m apart.
* The coordinate systems of the tables are 180° rotated from each other (xytable1 has 0,0 in the "lower-right", while xytable2 has 0,0 in the "upper-left").
* For the arrays to be aligned "head on", the x-coordinate must follow this pattern:
 * When xytable1 at x=0, then xytable2 at x=1300
 * When xytable1 at x=650, then xytable2 at x=650
 * When xytable1 at x=1300, then xytable2 at x=0
* Angles are defined relative to each array.
 * Angles toward the "positive direction" are clockwise when viewed from overhead.
 * Angles toward the "negative direction" are counter-clockwise when viewed from overhead.
* If the antennas are aligned on the x-axis, then an angle of 0° will ensure the antennas are facing each other.
[[BR]]
=== Usage ===
All the available methods are accessible from the a testbed console via an HTTP API located at `am1.cosmos-lab.org:5054/xy_table`. This API can be interacted with via a command line tool such as "curl" or any script using a "REST client" library.
[[BR]]
=== Get the Current Status & Positions ===
This API call is used to get the current status of the XY-table(s). The response will specify the current movement state of the XY platform and angular rotation systems as well as their current and target positions.
HTTP API Path: `am1.cosmos-lab.org:5054/xy_table/status`
Parameters:
 ||= '''Name''' =||= '''Decription''' =||= '''Required''' =||= '''Acceptable Input''' =||
 ||  name ||  Comma separated list of XY-table FQDNs  ||  Y  ||  (list of XY table FQDNs)  ||
Selected response values and their meaning:
* '''xy_status''':
 ||= '''Value''' =||= '''Decription''' =||
 ||  Idle  || Platform is stopped in the X and Y plane. ||
 ||  Run  || Platform is moving in the X and/or Y directions. ||
 ||  ''other values''  || Indicate possible error, may require staff intervention if persistent. ||
* '''rotator_status''':
 ||= '''Value''' =||= '''Decription''' =||
 ||  Limp  || Rotator is stopped but the motor is not trying to hold the position fixed. ||
 ||  Holding  || Rotator is stopped and the motor is trying to hold the position fixed. ||
 ||  Accelerating[[BR]]Travelling[[BR]]Decelerating  || Rotator is moving. ||
 ||  ''other values''  || Indicate possible error, may require staff intervention if persistent. ||
* '''current_position''': The position information at the time the request was issued. Note that this is not real-time and may have up to a 1 second delay.
* '''target_position''': The last requested X, Y, and angle positions.
==== Example 1 ====
Get status of `xytable1`.
HTTP Request:
{{{
am1.cosmos-lab.org:5054/xy_table/status?name=xytable1.sb1.cosmos-lab.org
}}}
Response:
{{{
  
    
      
      
    
  
}}}
==== Example 2 ====
Get status of `xytable1` and `xytable2`.
HTTP Request:
{{{
am1.cosmos-lab.org:5054/xy_table/status?name=xytable1.sb1.cosmos-lab.org,xytable2.sb1.cosmos-lab.org
}}}
Response:
{{{
  
    
      
      
    
    
      
      
    
  
}}}
[[BR]]
=== Move XY Table Platform ===
Moves the platform(s) to the desired X, Y coordinates and rotates it to the desired angle. The response will be a "status" style response immediately following the execution of the command.
HTTP API Path: `am1.cosmos-lab.org:5054/xy_table/move_to`
Parameters:
 ||= '''Name''' =||= '''Decription''' =||= '''Required''' =||= '''Acceptable Input''' =||
 ||  name  ||  Comma separated list of XY table FQDNs  ||  Y  ||  (list of XY table FQDNs)  ||
 ||  x  ||  X-axis target coordinate (mm)  ||  Y  ||  0 to 1300  ||
 ||  y  ||  Y-axis target coordinate (mm)  ||  Y  ||  0 to 1300  ||
 ||  angle  ||  Target angle (deg)  ||  Y  ||  -45 to 45  ||
==== Example 1 ====
Move the platform of `xytable1` to X=500 and Y=30, and rotate to 15 degrees. 
HTTP Request:
{{{
am1.cosmos-lab.org:5054/xy_table/move_to?name=xytable1.sb1.cosmos-lab.org&x=500&y=30&angle=15
}}}
Response:
{{{
  
    
      
      
    
  
}}}
[[BR]]
=== Stop the Current Movement ===
Immediately cancels the last requested movement and bring the platform(s) to a stop.
HTTP API Path: `am1.cosmos-lab.org:5054/xy_table/stop`
Parameters:
 ||= '''Name''' =||= '''Decription''' =||= '''Required''' =||= '''Acceptable Input''' =||
 ||  name  ||  Comma separated list of XY table FQDNs  ||  Y  ||  (list of XY table FQDNs)  ||
==== Example 1 ====
Stop the current movement of `xytable1`. 
HTTP Request:
{{{
am1.cosmos-lab.org:5054/xy_table/stop?name=xytable1.sb1.cosmos-lab.org
}}}
Response:
{{{
  
    
      
    
  
}}}