Vicon Toolkit Documentation

<< Back to the Vicon Toolkit page

This section provides a list of components and classes from the ILAB Vicon Toolkit, with documentation on useful properties and methods. This section of the toolkit deals with lower level aspects of object tracking - mainly dealing with data acquisition from the Vicon hardware. The ILAB Vicon Subject Library provides higher level functionality dealing with object tracking and relationships.

ViconManager Class

Description

This is a component that you drop onto your Form to gain access to Vicon functionality.

Properties

  • bool IsConnected - Gets a value of true if the ViconManager object is connected to the Vicon Nexus. Otherwise it returns false.
  • IPAddress IP - Gets or sets the target IP address of the Nexus.
  • int Port - Gets or sets the target port of the Nexus.
  • float FrameRate - Gets the frame rate returned by the Nexus.
  • ViconSubject this[string key] - Gets the subject at the given key name.
  • List<ViconSubject> Subjects - A list of ViconSubject objects representing subject data returned from the Nexus.
  • int AutoPollInterval - Gets or sets the interval in milliseconds for automatic Nexus polling.
  • bool AutoPollingEnabled - Gets or sets whether the ViconManager should automatically poll the Nexus for updated data, according to the AutoPollInterval.

Methods

  • void ManualPoll() - Used to manually poll the Nexus for updated data. Will throw an exception if AutoPollingEnabled is set to true.
  • bool HasSubject(string key) - Returns true if a subject with the given key name exists in the collection of subjects.
  • string GetRawData() - Returns a string containing the raw data tags from the Nexus.
  • DialogResult ShowConnectionDialog(IPAddress useip, int port) - Shows a dialog box for the user to enter or confirm connection parameters. A default IP address and port can be specified. (3 overrides)
  • void Connect() - Called to attempt a connection to the Nexus using the specified IP and Port.
  • void Disconnect() - Called to terminate an existing connection to the Nexus.

Events

  • EventHandler Connected - Triggered when a connection is successfully established to the Nexus.
  • EventHandler ConnectionFailed - Triggered when a connection attempt to the Nexus encounters a failure.
  • EventHandler Disconnected - Triggered when the ViconManager disconnects from the Nexus.
  • EventHandler ChannelUpdated - Triggered when the ViconManager receives a new or altered data schema. This is called once when the ViconManager first connects to the Nexus and retrieves the subjects list. It can be triggered later if a subject is added/removed or if the subject segment/joint/marker schema is altered.
  • EventHandler DataUpdated - Triggered when the ViconManager receives new data from the Nexus. Called as a result of invoking ManualPoll or on the interval of automatic polling. The ViconManager is populated with the new data prior to invoking this event, so the event handler may access the new data when called.
  • EventHandler AfterDataUpdated - Triggered after the positions of missing subject markers have been reconstructed, which occurs after DataUpdated is invoked.

ViconSubject Class

Description

Represents a known subject or body that the Vicon Nexus is tracking.

Properties

  • string Name - Gets the name of the subject, which uniquely identifies it.
  • ViconMarkerSet Markers - Returns a collection of ViconMarker objects which represent all markers within the subject.
  • ViconSegmentSet Segments - Returns a collection of ViconSegment objects which represents all segments within the subject.
  • ViconJointSet Joints - Returns a collection of ViconJoint objects which represents all joints within the subject.
  • bool IsActive - Returns true if the Nexus has received data for the subject, returns false otherwise.
  • int DetectedMarkerCount - Returns the number of markers actually captured by the Vicon Nexus. This number will be less than or equal to the total number of markers for this subject, depending on occlusion and visual range of the Vicon cameras.
  • ViconManager Parent - Returns the ViconManager object to which this subject belongs.
  • bool IsBound - Returns true if the subject was properly bound to a Vicon Skeleton Definition, false if not. NOTE: The Vicon Toolkit expects a copy of the Vicon Skeleton file (.VSK) of all tracked subjects to be present in the /subjects folder, which is a subfolder adjacent to the executable.
  • List<ViconMarker[]> Sticks - Returns a list of start and end markers that connect the subject markers together into a visible structure. This is usually a trivial definition used within the Nexus software, however it may be useful for displaying objects.

Methods

  • Vector3 WorldToPlane(Vector3 vec) - Converts a vector in world coordinates to the coordinate system defined by the 3 basis markers of the subject.
  • Vector3 PlaneToWorld(Vector3 vec) - Converts a vector from the coordinate system defined by the 3 basis markers of the subject to world coordinates.
  • Vector3 LocalToPlane(Vector3 vec) - Converts a vector from local subject coordinates to coordinate system defined by the 3 basis markers of the subject.
  • Vector3 PlaneToLocal(Vector3 vec) - Converts a vector from coordinate system defined by the 3 basis markers of the subject to local subject coordinates.
  • Vector3 WorldToLocal(Vector3 vec) - Converts a vector in world coordinates to local subject coordinates.
  • Vector3 LocalToWorld(Vector3 vec) - Converts a vector in local subject coordinates to world coordinates.

Events

  • This object does not define any events.

ViconSegment Class

Description

An object that represents a rigid component of a subject. Every subject has at least one segment, which at the very least represents the entire object as a rigid body. Subjects with joints will have more than one segment, representing rigid parts that hinge together on the joint. (NOTE: At the current time, the Segment is lesser used functionality and has yet to be completed and tested.)

Properties

  • string Name - Gets the name of the segment, which uniquely identifies it within the subject.
  • bool IsActive - Returns the result of IsActive from the parent ViconSubject.
  • Vector3 PrimaryAxis - Returns a vector representing the primary axis, defined by two basis markers.
  • Vector3 SecondaryAxis - Returns a vector representing the secondary axis, defined by two basis markers.
  • ViconSubject Parent - Returns the parent ViconSubject object.
  • List<ViconTag> Tags - Returns a list of pre-parsed vicon tags for manual access to segment information.

Methods

  • This object does not define any methods.

Events

  • This object does not define any events.

ViconJoint Class

Description

An object that represents a joint amongst ViconSegments within a subject. Rigid objects (with one single segment) do not have joints. (NOTE: At the current time, the Joint is lesser used functionality and has yet to be completed and tested.)

Properties

  • string Name - Gets the name of the segment, which uniquely identifies it within the subject.
  • bool IsActive - Returns the result of IsActive from the parent ViconSubject.
  • ViconSubject Parent - Returns the parent ViconSubject object.
  • List<ViconTag> Tags - Returns a list of pre-parsed vicon tags for manual access to joint information.

Methods

  • This object does not define any methods.

Events

  • This object does not define any events.

ViconMarker Class

Description

An object representing a marker within the subject.

Properties

  • string Name - Gets the name of the segment, which uniquely identifies it within the subject.
  • bool IsActive - Returns the result of IsActive from the parent ViconSubject.
  • ViconSubject Parent - Returns the parent ViconSubject object.
  • List<ViconTag> Tags - Returns a list of pre-parsed vicon tags for manual access to joint information.
  • Vector3 Location - Returns the marker's position in world coordinates.
  • bool IsRequired - Returns true if the marker is one of the required basis markers, false if not.
  • bool IsDetected - Returns true if the marker position was detected by the Nexus, false if not.
  • bool IsAvailable - Returns true if the marker position was detected by the Nexus, or its value was reconstructed. Returns false if the position could not be found by either method.
  • Vector3 LocalPosition - Returns the local subject coordiates of the marker.

Methods

  • This object does not define any methods.

Events

  • This object does not define any events.

DisplayPlane Component

Description

The DisplayPlane class is a component that you drop onto your Form to represent a display surface. An interface can be invoked to calibrate the display position, which is done by positioning a known marker at three of the four corners. Calibration data can be saved and loaded so that calibration is not necessary each time the program is run.

Properties

  • string DisplayID - A unique name to describe the display.
  • ViconManager ViconManager - The ViconManager component that deals with the display.
  • FileInfo ConfigFile - The default name for the configuration file, based on the DisplayID.
  • InteractiveDisplayType DisplayType - A flag that indicates the orientation of the display (ie. Horizontal, Vertical, etc.).
  • Vector3 TopLeftCorner - The position of the top left-hand corner of the display in world coordinates.
  • Vector3 TopRightCorner - The position of the top right-hand corner of the display in world coordinates.
  • Vector3 BottomLeftCorner - The position of the bottom left-hand corner of the display in world coordinates.
  • Vector3 BottomRightCorner - The position of the bottom right-hand corner of the display in world coordinates.
  • Vector3 Width - The width of the display in world units.
  • Vector3 Height - The height of the display in world units.
  • Matrix Basis - The transformation matrix between world coordinates and screen coordinates.
  • Matrix BasisInverse - The transformation matrix between screen coordinates and world coordinates.
  • bool HasBasis - Indicates whether the display has been calibrated yet - true means yes, false means no.
  • Vector3 Normal - Gets a vector normal to the display surface (in world coordinates).

Methods

  • void ShowCalibrationDialog() - Invokes the dialog window that asks the user to manually calibrate the position of the display.
  • void SaveConfiguration() - Saves the current calibration configuration into an XML file adjacent to the executable.
  • bool LoadConfiguration() - Loads the calibration configuration from an XML file adjacent to the executable if it exists (returns true). Otherwise returns false.
  • Vector3 WorldToPlane(Vector3 vec) - Transforms a vector from world coordinates to screen coordinates.
  • Vector3 PlaneToWorld(Vector3 vec) - Transforms a vector from screen coordinates to world coordinates.

Events

  • This object does not define any events.

ViconSubjectTree Control

Description

A convenient control that displays a tree view of all ViconSubjects, which can be expanded to view and select their subparts - segments, joints, or markers.

Properties

  • ViconManager ViconManager - The ViconManager component to display the subject tree for.
  • ViconSubject SelectedSubject - Gets or sets the selected ViconSubject object. Returns null if another type of object is selected (or there is no selection).
  • ViconSubject SelectedSegment - Gets or sets the selected ViconSegment object. Returns null if another type of object is selected (or there is no selection).
  • ViconSubject SelectedJoint - Gets or sets the selected ViconJoint object. Returns null if another type of object is selected (or there is no selection).
  • ViconSubject SelectedMarker - Gets or sets the selected ViconMaker object. Returns null if another type of object is selected (or there is no selection).

Methods

  • This object does not define any methods.

Events

  • This object does not define any events.

ViconSubjectView2D Control

Description

A control to display a simple visualization of the subject data captured by the Nexus.

Properties

  • ViconManager ViconManager - The ViconManager to visualize.
  • View2DAxes View2D - Gets or sets one of 3 orthogonal planar views (XY, XZ, YZ).
  • RectangleF BoundsXZ - The area of world space to visualize in the XZ plane.
  • RectangleF BoundsXY - The area of world space to visualize in the XY plane.
  • RectangleF BoundsYZ - The area of world space to visualize in the YZ plane.

Methods

  • void Calibrate() - Attempt to compute a best fit cube that encompasses all subject markers.
  • RectangleF GetBounds2D(View2DAxes view) - Gets the bounding area for the specified plane.
  • PointF GetPoint2D(Vector3 p, View2DAxes view) - Gets the 2D coordinate of the specified vector for the specified view.
  • PointF Point2DToControl(PointF p) - Translates the 2D coordinate from world space to the client bounds of the control.

Events

  • This object does not define any events.

DisplaySubjectView2D

Description

A control to display a simple visualization of the subject data captured by the Nexus, in relation to a particular DisplayPlane.

Properties

  • ViconManager ViconManager - The ViconManager to visualize.
  • DisplayPlane DisplayPlane - The DisplayPlane to visualize.
  • View2DAxes View2D - Gets or sets one of 3 orthogonal planar views (XY, XZ, YZ).

Methods

  • PointF Point3DToClient(Vector3 point, View2DAxes view) - Translates a 3D point in world space to the corresponding 2D point in the client bounds of the control.

Events

  • This object does not define any events.