Using Sensors: Effort Sensor
Learning Objectives
This tutorial introduces how to use an effort sensor for sensing a joint effort in Omniverse Isaac Sim. After this tutorial, you will know how to add a effort sensor to the scene, activate, and measure acceleration, angular velocity, and orientations in a scene
10-15 Minute Tutorial
Getting Started
Prerequisites
Review the Core Tutorial series a prior to beginning this tutorial.
This tutorial demonstrates how to integrate the effort sensor into an Omniverse Isaac Sim simulation, by going over the method to create the effort sensor, modify effort sensor properties, and read effort sensor data.
Effort Sensor Properties
enabled
parameter determines if the sensor is running or note.sensor period
parameter specifies the time inbetween sensor measurement. A sensor period that’s lower than the physics delta time will always output the latest physics data. The sensor frequency cannot go beyond the physics frequency.use_latest_data
parameter will make the sensor always use the latest simulation data if enabled.dof
parameter stores the index of the joint measured. The recommended way to update it is by calling update_dof_name(dof_name=name_of_the_joint) function.data_buffer_size
parameter stores the size of the data buffer used in user’s custom interpolation function. The recommended way to update it is by calling change_buffer_size(new_buffer_size=size_of_buffer).
Creating and Modifying the effort sensor
The effort sensor can be created using a python class. The only required parameters is the prim path of the specific joint that the sensor measures from.
1from omni.isaac.sensor.scripts.effort_sensor import EffortSensor
2import numpy as np
3
4sensor = EffortSensor(
5 prim_path="/Articulation/Arm/RevoluteJoint",
6 sensor_period=0.1,
7 use_latest_data=False,
8 enabled=True
9)
To modify sensor parameters, you can change class member variables like sensor_period
, use_latest_data
, and enabled
directly, and for changing the dof_name
and buffer_size
for the readings, please use the corresponding member functions update_dof_name
and change_buffer_size
.
Reading Sensor Output
get_sensor_reading(self, interpolation_function = None, use_latest_data = False)
the get sensor reading function takes in two parameters: an interpolation function (optional) to use in place of the default linear interpolation function, and use latest data flag (optional) for retrieving the data point from the current physics step if the sensor is running at a slower rate than physics rate.
The function will return an EsSensorReading
object which contains is_valid
, time
, and value
Sample usage to get the reading from the current frame:
1from omni.isaac.sensor.scripts.effort_sensor import EffortSensor
2
3# create a new effort sensor
4sensor = EffortSensor(
5 prim_path="/Articulation/Arm/RevoluteJoint",
6 sensor_period=0.1,
7 use_latest_data=False,
8 enabled=True
9)
10
11# get sensor reading
12reading = sensor.get_sensor_reading(use_latest_data = True)
Sample usage with custom interpolation function:
1from omni.isaac.sensor.scripts.effort_sensor import EffortSensor, EsSensorReading
2
3
4# Input Param: List of past EsSensorReading, time of the expected sensor reading
5def interpolation_function(data, time):
6 interpolated_reading = EsSensorReading()
7 # do interpolation
8 return interpolated_reading
9
10# create a new effort sensor
11sensor = EffortSensor(
12 prim_path="/Articulation/Arm/RevoluteJoint",
13 sensor_period=0.1,
14 use_latest_data=False,
15 enabled=True
16)
17
18# get sensor readings
19reading = sensor.get_sensor_reading(interpolation_function)
Isaac Read Effort Node
For reading effort sensor data using the Omnigraph, see this tutorial: Effort Sensor Node.
API Documentation
See the API Documentation for complete usage information.