Camera IMU
Introduction
These functions are responsible for configuring and retrieving motion data from the IMU sensor.
These IMU APIs are supported only on VCM and TEVM cameras. Ensure your device hardware is compatible before calling these functions.
VxEnableIMUMode
Function:
- C++
- Python
- C#
- C
int VxEnableIMUMode(std::shared_ptr<VxCamera> vxcam, VX_IMU_MODE mode)
def VxEnableIMUMode(vxcam, mode)
int VxEnableIMUMode(VxCamera vxcam, VX_IMU_MODE mode)
int vx_enable_imu_mode(vx_camera vxcam, vx_imu_mode mode)
Function Description:
- This function is used to activate the IMU sensor on the VxCamera.
This is a required initialization step before the SDK can access IMU data.
Parameter Description:
-
vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
-
mode : A VX_IMU_MODE format variable which stored the mode value.
-
VX_IMU_MODE format:
- C++
- Python
- C#
- C
enum class VX_IMU_MODE{
DISABLE,
ISPU,
SELF_TEST
}class VX_IMU_MODE(Enum):
DISABLE = 0
ISPU = 1
SELF_TEST = 2public enum VX_IMU_MODE {
DISABLE,
ISPU,
SELF_TEST
}typedef enum vx_imu_mode {
DISABLE,
ISPU,
SELF_TEST
} vx_imu_mode;
Return Values:
- return 0 = PASS, return -1 = FAIL
Example:
- C++
- Python
- C#
- C
VX_IMU_MODE mode = VX_IMU_MODE::ISPU;
// enable the imu mode
VxEnableIMUMode(vxcam, mode);
from pyvizionsdk import VX_IMU_MODE
# enable the imu mode
ret = pyvizionsdk.VxEnableIMUMode(vxcam, VX_IMU_MODE.ISPU)
VX_IMU_MODE mode = VX_IMU_MODE.ISPU;
// enable the imu mode
CSVizionSDK.VxEnableIMUMode(vxcam, mode);
vx_imu_mode mode = ISPU;
// enable the imu mode
vx_enable_imu_mode(vxcam, mode);
VxRebootIMUMode
Function:
- C++
- Python
- C#
- C
int VxRebootIMUMode(std::shared_ptr<VxCamera> vxcam, VX_IMU_MODE mode)
def VxRebootIMUMode(vxcam, mode)
int VxRebootIMUMode(VxCamera vxcam, VX_IMU_MODE mode)
int vx_reboot_imu_mode(vx_camera vxcam, vx_imu_mode mode)
Function Description:
- This function reboots the IMU mode and enables it as part of the same operation.
This function also enables the IMU mode. A separate call to enable the IMU mode is not required.
Parameter Description:
-
vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
-
mode : A VX_IMU_MODE format variable which stored the mode value.
-
VX_IMU_MODE format:
- C++
- Python
- C#
- C
enum class VX_IMU_MODE{
DISABLE,
ISPU,
SELF_TEST
}class VX_IMU_MODE(Enum):
DISABLE = 0
ISPU = 1
SELF_TEST = 2public enum VX_IMU_MODE {
DISABLE,
ISPU,
SELF_TEST
}typedef enum vx_imu_mode {
DISABLE,
ISPU,
SELF_TEST
} vx_imu_mode;
Return Values:
- return 0 = PASS, return -1 = FAIL
Example:
- C++
- Python
- C#
- C
VX_IMU_MODE mode = VX_IMU_MODE::ISPU;
// reboot the imu mode
VxRebootIMUMode(vxcam, mode);
from pyvizionsdk import VX_IMU_MODE
# reboot the imu mode
ret = pyvizionsdk.VxRebootIMUMode(vxcam, VX_IMU_MODE.ISPU)
VX_IMU_MODE mode = VX_IMU_MODE.ISPU;
// reboot the imu mode
CSVizionSDK.VxRebootIMUMode(vxcam, mode);
vx_imu_mode mode = ISPU;
// reboot the imu mode
vx_reboot_imu_mode(vxcam, mode);
VxGetIMUAccData
Function:
- C++
- Python
- C#
- C
int VxGetIMUAccData(std::shared_ptr<VxCamera> vxcam, std::vector<float>& accArr, VX_IMU_SELF_TEST_MODE mode)
def VxGetIMUAccData(vxcam, mode)
int VxGetIMUAccData(VxCamera vxcam, FloatVector accArr, VX_IMU_SELF_TEST_MODE mode)
int vx_get_imu_acc_data(vx_camera vxcam, float** accArr, vx_imu_self_test_mode mode)
Function Description:
- This function retrieves a list of 3-axis IMU acceleration data (x, y, z) from the VxCamera device.
- Ensure that the IMU SELF_TEST mode is enabled before calling this function.
- C# : The caller must create a
FloatVectorinstance before calling this function. - C : The float list need to release by
vx_release_imu_datafunction.
Parameter Description:
-
vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
-
accArr : A vector of float type. The function will populate this vector with 3-axis IMU acceleration data.
-
Return:
- return 0 = PASS, return -1 = FAIL
- Python : tuple(return_code, accArr)
return_code : return 0 = PASS, return -1 = FAIL
-
VX_IMU_SELF_TEST_MODE format:
- C++
- Python
- C#
- C
enum class VX_IMU_SELF_TEST_MODE {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED
}class VX_IMU_SELF_TEST_MODE(Enum):
NORMAL = 0
POSITIVE = 1
NEGATIVE = 2
NOT_ALLOWED = 3public enum VX_IMU_SELF_TEST_MODE {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED
}typedef enum vx_imu_self_test_mode {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED,
} vx_imu_self_test_mode;
Example:
- C++
- Python
- C#
- C
// enable IMU mode
VxEnableIMUMode(vxcam, VX_IMU_MODE::SELF_TEST);
std::vector<float> accArr;
// get IMU acceleration data
VxGetIMUAccData(vxcam, accArr, VX_IMU_SELF_TEST_MODE::POSITIVE);
from pyvizionsdk import VX_IMU_SELF_TEST_MODE, VX_IMU_MODE
# enable IMU mode
pyvizionsdk.VxEnableIMUMode(vxcam, VX_IMU_MODE.SELF_TEST)
# get IMU acceleration data
result, accArr = pyvizionsdk.VxGetIMUAccData(vxcam, VX_IMU_SELF_TEST_MODE.POSITIVE)
// enable IMU mode
CSVizionSDK.VxEnableIMUMode(vxcam, VX_IMU_MODE.SELF_TEST);
FloatVector accArr = new FloatVector();
// get IMU acceleration data
CSVizionSDK.VxGetIMUAccData(vxcam, accArr, VX_IMU_SELF_TEST_MODE.POSITIVE);
// enable IMU mode
vx_enable_imu_mode(vxcam, SELF_TEST);
float* accArr;
// get IMU acceleration data
vx_get_imu_acc_data(cam, &accArr, POSITIVE);
// release data
vx_release_imu_data(accArr);
VxGetIMUGyrData
Function:
- C++
- Python
- C#
- C
int VxGetIMUGyrData(std::shared_ptr<VxCamera> vxcam, std::vector<float>& gyrArr, VX_IMU_SELF_TEST_MODE mode)
def VxGetIMUGyrData(vxcam, mode)
int VxGetIMUGyrData(VxCamera vxcam, FloatVector gyrArr, VX_IMU_SELF_TEST_MODE mode)
int vx_get_imu_gyr_data(vx_camera vxcam, float** gyrArr, vx_imu_self_test_mode mode)
Function Description:
- This function retrieves a list of 3-axis IMU gyroscope data (x, y, z) from the VxCamera device.
- Ensure that the IMU SELF_TEST mode is enabled before calling this function.
- C# : The caller must create a
FloatVectorinstance before calling this function. - C : The float list need to release by
vx_release_imu_datafunction.
Parameter Description:
-
vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
-
gyrArr : A vector of float type. The function will populate this vector with 3-axis IMU gyroscope data.
-
Return:
- return 0 = PASS, return -1 = FAIL
- Python : tuple(return_code, gyrArr)
return_code : return 0 = PASS, return -1 = FAIL
-
VX_IMU_SELF_TEST_MODE format:
- C++
- Python
- C#
- C
enum class VX_IMU_SELF_TEST_MODE {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED
}class VX_IMU_SELF_TEST_MODE(Enum):
NORMAL = 0
POSITIVE = 1
NEGATIVE = 2
NOT_ALLOWED = 3public enum VX_IMU_SELF_TEST_MODE {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED
}typedef enum vx_imu_self_test_mode {
NORMAL,
POSITIVE,
NEGATIVE,
NOT_ALLOWED,
} vx_imu_self_test_mode;
Example:
- C++
- Python
- C#
- C
// enable IMU mode
VxEnableIMUMode(vxcam, VX_IMU_MODE::SELF_TEST);
std::vector<float> gyrArr;
// get IMU gyroscope data
VxGetIMUAccData(vxcam, gyrArr, VX_IMU_SELF_TEST_MODE::POSITIVE);
from pyvizionsdk import VX_IMU_SELF_TEST_MODE, VX_IMU_MODE
# enable IMU mode
pyvizionsdk.VxEnableIMUMode(vxcam, VX_IMU_MODE.SELF_TEST)
# get IMU gyroscope data
result, gyrArr = pyvizionsdk.VxGetIMUAccData(vxcam, VX_IMU_SELF_TEST_MODE.POSITIVE)
// enable IMU mode
CSVizionSDK.VxEnableIMUMode(vxcam, VX_IMU_MODE.SELF_TEST);
FloatVector gyrArr = new FloatVector();
// get IMU gyroscope data
CSVizionSDK.VxGetIMUGyrData(vxcam, gyrArr, VX_IMU_SELF_TEST_MODE.POSITIVE);
// enable IMU mode
vx_enable_imu_mode(vxcam, SELF_TEST);
float* gyrArr;
// get IMU gyroscope data
vx_get_imu_gyr_data(cam, &gyrArr, POSITIVE);
// release data
vx_release_imu_data(gyrArr);
vx_release_imu_data
This function is only supported in C.
Function:
- C
void vx_release_imu_data(float* imu_data)
Function Description:
- This function release IMU list retrieved from vx_get_imu_acc_data() and vx_get_imu_gyr_data().
Parameter Description:
- format_list : A float type IMU data list.
Example:
- C
float* accArr;
vx_get_imu_acc_data(cam, &accArr, POSITIVE);
vx_release_imu_data(accArr);
VxGetISPUData
Function:
- C++
- Python
- C#
- C
int VxGetISPUData(std::shared_ptr<VxCamera> vxcam, VxImuIspu& ispuData)
def VxGetISPUData(vxcam)
int VxGetISPUData(VxCamera vxcam, VxImuIspu ispuData)
int vx_get_ispu_data(vx_camera vxcam, vx_imu_ispu* ispuData)
Function Description:
- This function retrieves a structure containing IMU ISPU data from the VxCamera device.
- Ensure that the IMU ISPU mode is enabled before calling this function.
Parameter Description:
-
vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
-
ispuData : A VxImuIspu structure that is populated by the function with IMU ISPU data.
-
Return:
- return 0 = PASS, return -1 = FAIL
- Python : tuple(return_code, ispuData)
return_code : return 0 = PASS, return -1 = FAIL
-
VxImuIspu structures:
- C++
- Python
- C#
- C
struct VxImuIspu{
float x;
float y;
float z;
float w;
float yaw;
float pitch;
float roll;
}class VxImuIspu:
def __init__(self, x, y, z, w, yaw, pitch, roll):
self.x = x
self.y = y
self.z = z
self.w = w
self.yaw = yaw
self.pitch = pitch
self.roll = rollpublic struct VxImuIspu {
public float x;
public float y;
public float z;
public float w;
public float yaw;
public float pitch;
public float roll;
}typedef struct vx_imu_ispu{
float x;
float y;
float z;
float w;
float yaw;
float pitch;
float roll;
} vx_imu_ispu;
Example:
- C++
- Python
- C#
- C
// enable imu ISPU mode
VxEnableIMUMode(vxcam, VX_IMU_MODE::ISPU);
VxImuIspu ispuData;
// get IMU ISPU data
VxGetISPUData(vxcam, ispuData);
from pyvizionsdk import VX_IMU_MODE
# enable IMU ISPU mode
pyvizionsdk.VxEnableIMUMode(vxcam, VX_IMU_MODE.ISPU)
# get IMU ISPU data
result, ispuData = pyvizionsdk.VxGetISPUData(vxcam)
// enable IMU ISPU mode
CSVizionSDK.VxEnableIMUMode(vxcam, VX_IMU_MODE.ISPU);
VxImuIspu ispuData = new VxImuIspu();
// get IMU ISPU data
CSVizionSDK.VxGetISPUData(vxcam, ispuData);
// enable IMU ISPU mode
vx_enable_imu_mode(vxcam, ISPU);
vx_imu_ispu ispuData;
// get IMU ISPU data
vx_get_ispu_data(cam, &ispuData);
VxGetIMUTemperature
Function:
- C++
- Python
- C#
- C
int VxGetIMUTemperature(std::shared_ptr<VxCamera> vxcam, float& temperature)
def VxGetIMUTemperature(vxcam)
int VxGetIMUTemperature(VxCamera vxcam, out float temperature)
int vx_get_imu_temperature(vx_camera vxcam, float* temperature)
Function Description:
- This function retrieves the temperature from the camera IMU sensor.
Parameter Description:
- vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
- temperature : A float variable that will be populated by the function with temperature data.
- Return:
- return 0 = PASS, return -1 = FAIL
- Python : tuple(return_code, temperature)
return_code : return 0 = PASS, return -1 = FAIL
Example:
- C++
- Python
- C#
- C
float temperature;
// get IMU temperature
VxGetIMUTemperature(vxcam, temperature);
# get IMU temperature
ret, temperature = pyvizionsdk.VxGetIMUTemperature(vxcam)
float temperature;
// get IMU temperature
CSVizionSDK.VxGetIMUTemperature(vxcam, out temperature);
float temperature;
// get IMU temperature
vx_get_imu_temperature(vxcam, &temperature);
VxGetIMUSensorTime
Function:
- C++
- Python
- C#
- C
int VxGetIMUSensorTime(std::shared_ptr<VxCamera> vxcam, float& sensorTime)
def VxGetIMUSensorTime(vxcam)
int VxGetIMUSensorTime(VxCamera vxcam, out float sensorTime)
int vx_get_imu_sensor_time(vx_camera vxcam, float* sensorTime)
Function Description:
- This function retrieves the sensor time from the camera IMU sensor.
Parameter Description:
- vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
- sensorTime : A float variable that will be populated by the function with IMU sensor time data.
- Return:
- return 0 = PASS, return -1 = FAIL
- Python : tuple(return_code, sensorTime)
return_code : return 0 = PASS, return -1 = FAIL
Example:
- C++
- Python
- C#
- C
float sensorTime;
// get IMU sensor time
VxGetIMUSensorTime(vxcam, sensorTime);
# get IMU sensor time
ret, sensorTime = pyvizionsdk.VxGetIMUSensorTime(vxcam)
float sensorTime;
// get IMU sensor time
CSVizionSDK.VxGetIMUSensorTime(vxcam, out sensorTime);
float sensorTime;
// get IMU sensor time
vx_get_imu_sensor_time(vxcam, &sensorTime);