Generating random Poses in Isaac SDK navsim application

Hi,

Following this tutorial I am running the navsim Isaac SDK applciation with the Carter navigation stack using Omniverse and the Robot Engine bridge, as specified in the mentioned tutorial. I extended this application to publish waypoints and goals to ROS.

Now I would like to further extend the navsim application to generate random poses in the map so as to use these poses as possible initial positions for spawning robot. The goal is to periodically generate these poses and publish them to ROS.

Reading the Isaac SDK documentation I thought I could do this using the isaac.navigation.RandomMapPoseSampler codelet. Since it generates a random pose and sets it in the pose tree, I created these two nodes in the navsim_navigate.app.json.

{
        "name": "initial_pose_generator",
        "components": [
          {
              "name": "isaac.navigation.RandomMapPoseSampler",
              "type": "isaac::navigation::RandomMapPoseSampler"
            },
            {
              "name": "isaac.navigation.RobotPoseGenerator",
              "type": "isaac::navigation::RobotPoseGenerator"
            },
            {
              "name": "random",
              "type": "isaac::alice::Random"
            },
            {
              "name": "message_ledger",
              "type": "isaac::alice::MessageLedger"
            }
        ]
      },
      {
        "name": "initial_pose_behavior",
        "components": [
          {
            "name": "isaac.alice.Behavior",
            "type": "isaac::behavior_tree::deprecated::Behavior"
          },
          {
            "name": "isaac.navigation.SelectorBehavior",
            "type": "isaac::behavior_tree::deprecated::SelectorBehavior"
          }
        ]
      },

Then to read the published message to the pose tree, I though of using the isaac.atlas.PoseToMessage codelet and I created another node:

      {
        "name": "pose_to_message",
        "components": [
          {
            "name": "isaac.atlas.PoseToMessage",
            "type": "isaac::atlas::PoseToMessage"
          },
          {
            "name": "MessageLedger",
            "type": "isaac::alice::MessageLedger"
          }
        ]
      }

Then I added an edge so that the pose could be published to ros:

{
  "source": "pose_to_message/isaac.atlas.PoseToMessage/pose",
   "target": "ros_update/initial_pose_to_ros/proto"
}

and the following config:

"pose_to_message": {
      "isaac.atlas.PoseToMessage": {
        "lhs_frame": "world",
        "rhs_frame": "robot_gt",
        "tick_period": "100ms"
      }
    },
    "initial_pose_generator": {
      "isaac.navigation.RandomMapPoseSampler" : {
        "rhs_frame" : "robot_gt",
        "tick_period": "100ms"
      },
      "random": {
        "use_random_seed": true
      }
    },
    "initial_pose_behavior": {
      "isaac.navigation.SelectorBehavior": {
        "desired_behavior": "initial",
        "tick_period": "100ms"
      },
      "isaac.alice.Behavior": {
        "aliases": [
          "initial"
        ],
        "nodes": [
          "$(fullname initial_pose_generator)"
        ]
      }
    },

This is the complete modified navsim_navigate.app.json with all the ROS configuration and node as well. navsim_navigate.app.json (9.7 KB)

Poses are correctly published to ROS every 100ms, however they are not random, it is always the same pose, even in different executions, even though the use_random_seed is set to True. I thought the isaac.navigation.RandomMapPoseSampler would randomly and periodically generate DIFFERENT poses and set them in the pose tree than then I could read using the pose_to_message/isaac.atlas.PoseToMessage/pose codelet.

I am not sure if I missunderstood the RandomMapPoseSampler or if I am doing something wrong in the code (please check the attached file to see the complete implementation).

I have also tried to set the tick_period to 100ms in all nodes - but this does not seem to work either,

Could someone explain me what I am doing wrong? Or another possible way to generate random poses to periodically spawn the robot at different positions? Thanks!

The RandomMapPoseSampler codelet does indeed only sample a single valid pose in the map and completes. The RobotPoseGenerator component manages the actual sampling, so you could write your own codelet that uses it like the following:

auto* pose_generator = node()->getComponent();
world_T_sample_ = pose_generator->sampleValidPose();

Finally, the RandomWalk codelet almost does what you want but also monitors for a stationary robot. You could change its timeout parameter to 100ms and keep the feedback receiver disconnected (making the codelet think the robot wasn’t moving).