Real Robot Interface
The simulation API is designed with the aim of making it easy to transition to the interface of the real robots. Below, we describe two different ways of switching between simulated and real robot:
Switching between
SimFinger
andRealFinger
Using the real-robot interface and replacing the hardware back end with the simulation.
Note also, that the interface of SimFinger
is
designed to be as similar as possible to the real-robot front end, so even switching
between the two should be relatively easy.
RealRobot Wrapper
The RealFinger
class provides a wrapper
around the real-robot interface which can be used as a drop-in replacement for
SimFinger
.
Simple example, sending control commands to the TriFinger:
from trifinger_simulation import sim_finger, real_finger
if use_real == True:
robot = real_finger.RealFinger(finger_type)
else:
robot = sim_finger.SimFinger(finger_type)
def step(action):
for _ in range(steps_per_control):
t = robot.append_desired_action(action)
observation = robot.get_observation()
You can see an example of this usage in our TriFingerReach environment.
Note
In order to use the RealFinger
class, you would need additional packages from
the TriFinger software bundle. See Using colcon.
Real Robot Front End with Simulation Back End
The robot_fingers package provides an robot_interfaces-based interface to the hardware of the real TriFinger robots.
It is possible to use the front end of the real-robot interface but with the simulation
plugged in as back end. This allows using the exact same code for simulation and real
robot. For more information on this, see How to use the Simulation Backend in the
robot_fingers
documentation.