Unable to get revolute joint to rotate

I’m currently trying to create a ackerman car in Issac sim. However I’m currently unable to get my revolute joints to rotate. Also I’m not sure what the correct controller would be. I tried to copy the code for the custom controller in the tutorial. I did crate a articulate root on the base of the robot. But still get error that issac sim can’t find it. Does anyone have a suggestion on what I can test? If I change velocity values in Articulation Inspector the wheels rotate and the robot move. I think either the USD file is configured wrong or that my code “connects” to the articulation wrong.

This is my code.

from omni.isaac.examples.base_sample import BaseSample
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.wheeled_robots.robots import WheeledRobot
from omni.isaac.core.utils.types import ArticulationAction
from omni.isaac.core.controllers import BaseController
from omni.isaac.dynamic_control import _dynamic_control

dc = _dynamic_control.acquire_dynamic_control_interface()

import numpy as np


class CoolController(BaseController):
    def __init__(self):
        super().__init__(name="my_cool_controller")
        # An open loop controller that uses a unicycle model
        self._wheel_radius = 0.03
        self._wheel_base = 0.1125
        return

    def forward(self, command):
        # command will have two elements, first element is the forward velocity
        # second element is the angular velocity (yaw only).
        joint_velocities = [0.0, 0.0, 0.0, 0.0]
        #joint_velocities[0] = ((2 * command[0]) - (command[1] * self._wheel_base)) / (2 * self._wheel_radius)
        #joint_velocities[1] = ((2 * command[0]) + (command[1] * self._wheel_base)) / (2 * self._wheel_radius)
        joint_velocities[0] = 1000
        # A controller has to return an ArticulationAction
        return ArticulationAction(joint_velocities=joint_velocities)


class HelloWorld(BaseSample):
    def __init__(self) -> None:
        super().__init__()
        return

    def setup_scene(self):
        world = self.get_world()
        world.scene.add_default_ground_plane()
        assets_root_path = get_assets_root_path()
        zjetbot_asset_path = "/home/oscsa287/Desktop/robot_car5.usd"
        world.scene.add(
            WheeledRobot(
                prim_path="/World/Fancy_Robot",
                name="fancy_robot",
                #wheel_dof_names=["left_wheel_joint", "right_wheel_joint"],
                wheel_dof_names=["back_left_joint", "back_right_joint", "front_left_joint", "front_right_joint"],
                create_robot=True,
                usd_path=jetbot_asset_path,
            )
        )
        
        return

    async def setup_post_load(self):
        self._world = self.get_world()
        self._jetbot = self._world.scene.get_object("fancy_robot")
        
        self._world.add_physics_callback("sending_actions", callback_fn=self.send_robot_actions)
        # Initialize our controller after load and the first reset
        self._my_controller = CoolController()
        return

    def send_robot_actions(self, step_size):
        #apply the actions calculated by the controller
        self._jetbot.apply_action(self._my_controller.forward(command=[0.20, np.pi / 4]))
        return

robot_car5.usd (20.5 KB)

Hi @fira

According to the code, the image, and the error messages, I think the problem is that the Articulation Root is configured for the /World/Fancy_Robot/chassi prim. However, in the code, you are instantiating the ```
WheeledRobot class passing prim_path="/World/Fancy_Robot" (that doesn’t have an Articulation Root). The prim_path is used for configuring the ArticulationView, which is why the errors.

Use /World/Fancy_Robot/chassi as prim_path or edit the .usd file and set the Articulation Root to the default prim

1 Like

@toni.sm

I tried to change the prim to /World/Fancy_Robot/chassi but still got the same error. Do you have any other suggestions?

Hi @fira

Can you share the .usd file and a minimum example code to reproduce?

1 Like

I finally got it to work. I create a new model similar how the jetbot is build using xforms. And then I had to make sure that the articulate root was the default prim. Thanks for the help @toni.sm

Here is an image for people in the future with similar problem. The car is the articulate root.
Screenshot at 2023-01-21 18-23-39