Skip to content

krocky-cooky/TRAVE_unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TRAVE_unity

version License Open in Visual Studio Code

TRAVE_unity is device operation interface for TRAVE.

TRAVE project is supported by MITOU foundation.

Install

Unity package is supported. Download unity package from here and import it.

Usage

Place the prefab in a scene

Inspector of the prefab Set up communication parameters.

Operate from scripts

using UnityEngine;
using TRAVE;

public class SampleClass : MonoBehaviour
{
  TRAVEDevice device = TRAVEDevice.GetDevice();
  
  void Start()
  {
    //Make connection with TRAVE device if connection hasn't been made.
    if(!device.isConnected)
    {
     device.ReConnectToDevice()
    }
    
    //Set up torque mode to 1.0
    device.SetTorqueMode(1.0f);
    
    //Apply changes to TRAVE device
    device.Apply();
  }
 }

API

TRAVEDevice

Device operation API.

static TRAVEDevice <TRAVEDevice>.GetDevice()

Returns singleton instance of TRAVEDevice.
TRAVEDevice instance have to be initialized with this method.

Returns
  • out: TRAVEDevice
    Singleton instance of TRAVEDevice.
public class SampleClass 
{
  TRAVEDevice device = TRAVEDevice.GetDevice();
}

bool <TRAVEDevice>.ReConnectToDevice()

Reconnect to TRAVE device.

Returns
  • out: bool
    if a connection has been made.

void <TRAVEDevice>.SetTorqueMode()

Set motor to torque mode and enter torque. (Change will not be applied without execution of <TRAVEDevice>.Apply() method)

Parameters
  • torque: float
  • spdLimit: float,optional
    Maximun value of speed. [default: 10.0f]
  • spdLimitLiftup: float,optional
    Maximun value of liftup speed. [default: 10.0f]

void <TRAVEDevice>.SetSpeedMode()

Set motor to speed mode and enter speed. (Change will not be applied without execution of <TRAVEDevice>.Apply() method)

Parameters
  • speed: float
  • trqLimit: float,optional
    Maximun value of torque.[default: 6.0f]

bool <TRAVEDevice>.Apply()

Apply changes to TRAVE hardware device.
This method cannot be call more than 5Hz.

Parameters
  • forceChange: bool,optional
    If true, force application regardless of the transmission interval.[default: false]
Returns
  • out: bool
    If settings are successfully applied.

bool <TRAVEDevice>.isConnected

if the connection between PC and TRAVE device is made.

string <TRAVEDevice>.motorMode

Current motor mode. Returns either "Torque Mode" or "Speed Mode".

float <TRAVEDevice>.torque

Current torque of the motor.

float <TRAVEDevice>.speed

Current speed of the motor.

float <TRAVEDevice>.position

Current position of the motor.

float <TRAVEDevice>.integrationAngle

Current integration angle of the motor.

TRAVEForceGauge

API for the force gauge.

License

MIT License