Trajectory Generator for Franka Panda Arm : not working

Hello,

I have tried to generate the trajectory of the Franka Panda robot using the LulaTaskSpaceTrajectoryGenerator. To do this, I followed a similar code style provided in the example: using UR10. However, I am encountering the following error:

Traceback (most recent call last):
  File "sanju_ws/sim_given_traj_franka_example.py", line 61, in <module>
    action_sequence = articulation_trajectory.get_action_sequence()
  File "/home/ksu1rng/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/articulation_trajectory.py", line 72, in get_action_sequence
    for t in np.arange(self._trajectory.start_time, self._trajectory.end_time, timestep):
  File "/home/ksu1rng/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/trajectory_generator.py", line 34, in start_time
    return self.trajectory.domain().lower
AttributeError: 'NoneType' object has no attribute 'domain'

I have written the following script, which is causing the aforementioned error:

from omni.isaac.kit import SimulationApp

simulation_app = SimulationApp({"headless": False})

from omni.isaac.motion_generation.lula import LulaTaskSpaceTrajectoryGenerator
from omni.isaac.motion_generation import ArticulationTrajectory
from omni.isaac.core import World
from omni.isaac.franka import Franka
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.core.utils.extensions import get_extension_path_from_name
from omni.isaac.core.prims import XFormPrim
import os
import numpy as np

my_world = World(stage_units_in_meters=1.0)

my_robot = my_world.scene.add(Franka(
    prim_path="/World/Franka",
    name="Franka",
))

end_effector_frame_name = "right_gripper"

my_world.reset()
my_robot.initialize()

# Lula config files for supported robots are stored in the motion_generation extension under "/motion_policy_configs"
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
rmp_config_dir = os.path.join(mg_extension_path, "motion_policy_configs")

#Initialize a LulaCSpaceTrajectoryGenerator object
task_space_trajectory_generator = LulaTaskSpaceTrajectoryGenerator(
    robot_description_path = rmp_config_dir + "/franka/rmpflow/robot_descriptor.yaml",
    urdf_path = rmp_config_dir + "/franka/lula_franka_gen.urdf",
)

# Choose reachable position and orientation targets
task_space_position_targets = np.array([
    [0.3, -0.3, 0.1],
    [0.3, 0.3, 0.1],
    [0.3, 0.3, 0.5],
    [0.3, -0.3, 0.5],
    [0.3, -0.3, 0.1]
    ])
task_space_orientation_targets = np.tile(np.array([0,1,0,0]),(5,1))

trajectory = task_space_trajectory_generator.compute_task_space_trajectory_from_points(
    task_space_position_targets, task_space_orientation_targets, end_effector_frame_name
)

if trajectory is None:
    print("No trajectory could be generated!")
    exit(0)

# Use the ArticulationTrajectory wrapper to run Trajectory on UR10 robot Articulation
physics_dt = 1/60.
articulation_trajectory = ArticulationTrajectory(my_robot,trajectory,physics_dt)

# Returns a list of ArticulationAction meant to be set on subsequent physics steps
action_sequence = articulation_trajectory.get_action_sequence()


#Create frames to visualize the task_space targets of the UR10
for i in range(len(task_space_position_targets)):
    add_reference_to_stage(get_assets_root_path() + "/Isaac/Props/UIElements/frame_prim.usd", f"/target_{i}")
    frame = XFormPrim(f"/target_{i}",scale=[.04,.04,.04])
    position = task_space_position_targets[i]
    orientation = task_space_orientation_targets[i]
    frame.set_world_pose(position,orientation)

#Run the action sequence on a loop
articulation_controller = my_robot.get_articulation_controller()
action_index = 0
while simulation_app.is_running():
    my_world.step(render=True)
    if my_world.is_playing():
        if action_index == 0:
            #Teleport robot to the initial state of the trajectory
            initial_state = action_sequence[0]
            my_robot.set_joint_positions(initial_state.joint_positions)
            my_robot.set_joint_velocities(initial_state.joint_velocities)

        articulation_controller.apply_action(action_sequence[action_index])

        action_index += 1
        action_index %= len(action_sequence)

simulation_app.close()

I have attempted to debug the code, but I am unable to identify the cause of this issue. Any assistance would be greatly appreciated.

Thanks!

Hi @ksu1rng - The error message suggests that the trajectory object is None. This means that the compute_task_space_trajectory_from_points method failed to generate a trajectory.

This could be due to several reasons:

  1. The target positions and orientations are not reachable by the robot. Make sure that the target positions and orientations are within the robot’s workspace and that the robot can reach them without violating any joint limits or collision constraints.
  2. The URDF or robot description files are incorrect or not found. Make sure that the paths to the URDF and robot description files are correct and that the files are valid.

To debug this issue, you can add some print statements or use a debugger to inspect the values of the variables and the state of the program at various points. For example, you can print the values of task_space_position_targets, task_space_orientation_targets, and trajectory to see if they are what you expect.