MotionSystems

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Liability

THE MOTION SYSTEMS COMPANY AND ITS DISTRIBUTORS ARE NOT LIABLE FOR ANY DAMAGE, INJURIES OR EVEN DEATH RESULTING FROM ANY ELEMENTS NOT PROVIDED BY THE MOTION SYSTEMS COMPANY AND/OR INCORRECT USE OR ASSEMBLY OF THE PRODUCT.

All trademarks, brands and logos are copyright of their respective owners.

ForceSeatMI library in your Unity 3D project

Examples:

For both examples, use built-in ForceSeatPM profile SDK - Positioning or SDK - Pos - Low FPS.

Positioning application requires usage of raw ForceSeatMI API. Typical operation routine consists of following steps:

  1. Create an API object variable inside your class:
    private ForceSeatMI m_fsmi;
  2. Initialize it in Start method:
    m_fsmi = new ForceSeatMI();
  3. If everything is loaded call:
    if (m_fsmi.IsLoaded())
    {
      m_fsmi.BeginMotionControl();
    }
  4. The SIM should send positioning data in constant intervals using one of the following functions:
    m_fsmi.SendTopTablePosLog(...);
    m_fsmi.SendTopTablePosPhy(...);
    m_fsmi.SendTopTableMatrixPhy(...);
     
  5. At the end of simulation call:
    if (m_fsmi.IsLoaded())
    {
      m_fsmi.EndMotionControl();
      m_fsmi.Dispose();
    }

ForceSeatMI API uses DLL which is installed as part of the ForceSeatPM software. Make sure that you have ForceSeatPM installed on your computer.

Code

Below code comes from TableLogPos_Unity example.

 
// FSMI api
private ForceSeatMI m_fsmi;
 
// Position in logical coordinates that will be send to the platform
private FSMI_TopTablePositionLogical m_platformPosition = new FSMI_TopTablePositionLogical();
 
void Start ()
{
  // Load ForceSeatMI library from ForceSeatPM installation directory
  // ForceSeatMI - BEGIN
  m_fsmi = new ForceSeatMI();
 
  if (m_fsmi.IsLoaded())
  {
    // Find platform's components
    m_shaft = GameObject.Find("Shaft");
    m_board = GameObject.Find("Board");
 
    SaveOriginPosition();
    SaveOriginRotation();
 
    // Prepare data structure by clearing it and setting correct size
    m_platformPosition.mask = 0;
    m_platformPosition.structSize = (byte)Marshal.SizeOf(m_platformPosition);
 
    m_platformPosition.state = FSMI_State.NO_PAUSE;
 
    // Set fields that can be changed by demo application
    m_platformPosition.mask = FSMI_POS_BIT.STATE | FSMI_POS_BIT.POSITION;
 
    m_fsmi.BeginMotionControl();
 
    SendDataToPlatform();
    // ForceSeatMI - END
  }
  else
  {
    Debug.LogError("ForceSeatMI library has not been found!Please install ForceSeatPM.");
  }
}
 
void OnDestroy()
{
  // ForceSeatMI - BEGIN
  if (m_fsmi.IsLoaded())
  {
    m_fsmi.EndMotionControl();
    m_fsmi.Dispose();
  }
  // ForceSeatMI - END
}
 
private void SendDataToPlatform()
{
  // Convert parameters to logical units
  // ForceSeatMI - BEGIN
  m_platformPosition.state = FSMI_State.NO_PAUSE;
  m_platformPosition.roll = (short)Mathf.Clamp(m_roll / DRAWING_ROLL_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX);
  m_platformPosition.pitch = (short)Mathf.Clamp(m_pitch / DRAWING_PITCH_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX);
  m_platformPosition.heave = (short)Mathf.Clamp(m_heave / DRAWING_HEAVE_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX);
 
  // Send data to platform
  m_fsmi.SendTopTablePosLog(ref m_platformPosition);
  // ForceSeatMI - END
}
 
 

Application: vehicle simulation

Examples: Telemetry_Veh_Unity (use built-in ForceSeatPM profile SDK - Vehicle Telemetry)

For vehicle simulation application ForceSeatMI_UnityVehicle helper interface can be used. Typical operation routine consists of following steps:

  1. Create an API object variable inside your class:
    private ForceSeatMI_UnityVehicle m_Api;
  2. Initialize it in Start method:
    m_Api = new ForceSeatMI_UnityVehicle();
  3. Call:
    m_Api.Begin();
  4. The SIM should send telemetry data in constant intervals using following function::
     m_Api.Tick(...);
  5. At the end of simulation call:
    m_Api.End();

Code

Below code comes from Telemetry_Veh_Unity example.

 
private void Start()
{
  m_Rigidbody = GetComponent<Rigidbody>();
 
  // ForceSeatMI - BEGIN
  m_Api = new ForceSeatMI_UnityVehicle();
  m_Api.Begin();
  // ForceSeatMI - END
}
 
private void OnDestroy()
{
  // ForceSeatMI - BEGIN
  m_Api.End();
  // ForceSeatMI - END
}
 
private void Move(float steering, float accel, float footbrake, float handbrake)
{
  ...
 
  // ForceSeatMI - BEGIN
  m_Api.Tick(m_Rigidbody, Time.deltaTime, false, 0, 0, m_CurrentGearNumber);
  // ForceSeatMI - END
}
 

Application: flight simulation

Examples: Telemetry_Fly_Unity (use built-in ForceSeatPM profile SDK - Plane Telemetry)

For flight simulation application ForceSeatMi_UnityAeroplane helper interface can be used. Typical operation routine consists of following steps:

  1. Create an API object variable inside your class:
    private ForceSeatMi_UnityAeroplane m_Api;
  2. Initialize it in Start method:
    m_Api = new ForceSeatMi_UnityAeroplane();
  3. Call:
    m_Api.Begin();
  4. The SIM should send telemetry data in constant intervals using following function::
     m_Api.Tick(...);
  5. At the end of simulation call:
    m_Api.End();

Code

Below code comes from Telemetry_Fly_Unity example.

 
private void Start()
{
  m_Rigidbody = GetComponent<Rigidbody>();
  m_OriginalDrag = m_Rigidbody.drag;
  m_OriginalAngularDrag = m_Rigidbody.angularDrag;
 
  // ForceSeatMI - BEGIN
  m_Api = new ForceSeatMI_UnityAeroplane();
  m_Api.Begin();
  // ForceSeatMI - END
}
 
private void OnDestroy()
{
  // ForceSeatMI - BEGIN
  m_Api.End();
  // ForceSeatMI - END
}
 
private void FixedUpdate()
{
  ...
 
  // ForceSeatMI - BEGIN
  m_Api.Tick(m_Rigidbody, Time.deltaTime, false);
  // ForceSeatMI - END
}