In this tutorial, we will learn how to set up a Gym-compatible environment interface to control the Franka Emika Panda robot. This can be changed for multiple robots/different robots/more objects and sensors as well.

Prerequisites

In this example we assume you are running a simulation that has the same set up seen below:

image.png


Setting up the Environment

Add a file called franka_env.py in the scripts folder.

This file defines a custom environment FrankaEnv that integrates with the Ark=robotics framework. It is designed to control and observe a Franka Emika Panda robot interacting with a ball object, either in simulation or the real world.


📦 File Structure

from ark.env.ark_env import ArkEnv
from arktypes import joint_group_command_t, joint_state_t, rigid_body_state_t
from arktypes.utils import pack, unpac

🧠 Class Overview: FrankaEnv

class FrankaEnv(ArkEnv):

This class wraps around ArkEnv and defines an environment tailored for the Franka robot. It is compliant with standard RL environment conventions.