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)