# Create a camera
omni.kit.commands.execute(
"CreatePrimWithDefaultXform",
prim_type="Camera",
prim_path="/sim_camera",
attributes={"focusDistance": 400, "focalLength": 24},
)
omni.kit.commands.execute(
"TransformPrimCommand",
path="/sim_camera",
old_transform_matrix=Gf.Matrix4d(
0.0, 1.0, -0.0, 0.0, -0.0, 0.0, 1.0, 0.0, 1.0, -0.0, 0.0, 0.0, 0.0, 0.0, -0.0, 1.0
),
new_transform_matrix=Gf.Matrix4d(
-0.642788,
0.766045,
0.0,
0.0,
-0.133022,
-0.111619,
0.984807,
0.0,
0.754407,
0.633022,
0.173648,
0.0,
175.0,
150.0,
70.0,
1.0,
),
)
# adding camera topic
omni.kit.commands.execute(
"ROSBridgeCreateCamera",
path="/ROS_Camera",
enabled=True,
resolution=Gf.Vec2i(1280, 720),
frame_id="sim_camera",
camera_info_topic="/camera_info",
rgb_enabled=True,
rgb_topic="/rgb",
depth_enabled=True,
depth_topic="/depth",
segmentation_enabled=False,
semantic_topic="/semantic",
instance_topic="/instance",
label_topic="/label",
bbox2d_enabled=False,
bbox2d_topic="/bbox_2d",
bbox3d_enabled=False,
bbox3d_topic="/bbox_3d",
queue_size=10,
camera_prim_rel=["/sim_camera"],
)
I copied this code from the rostopics.py
example in omni.isaac.ros_bridge
into my own code. However, while running rostopics.py
via GUI works (in that it creates topics /rgb, /semantic, etc), in my own code, it does not create these topics – when I run rostopic echo
, only the default roscore topics come up.
I remember that in version 2020.2 you also had to start up the editor. However, including the line self.editor = omni.kit.editor.get_editor_interface()
in my code yields an error saying that it resulted in a nullptr
. Moreover, in the example, there is the line:
if not self._timeline.is_playing():
self._timeline.play()
which I likewise incorporated into my code, but it also did not do anything.
Is there an additional step that needs to be done in order to get the topics to appear + publish? Also, is there a standalone Python API example for ROS bridge stuff?