setObjectPose, this client exposes
generic pub / sub / get operations over a predefined topic
registry. Topics are looked up by key (e.g. "set_object_pose"), and
the client handles CDR serialization using the topic’s declared ROS2
message type.
Usage::
client = SimClient()
Publish a Pose to the “set_object_pose” topic
client.pub(“set_object_pose”, { “position”: {“x”: 1.0, “y”: 2.0, “z”: 0.5}, “orientation”: {“x”: 0.0, “y”: 0.0, “z”: 0.0, “w”: 1.0}, })Subscribe and poll
client.sub(“get_object_pose”) pose = client.get(“get_object_pose”)Constructor
Signature
Methods
add_topic()
Signature
required
Lookup key (e.g.
"my_custom_topic").required
Zenoh key expression (e.g.
"/my/topic").required
ROS2 message class name from
ros2_types (e.g. "Pose").default:"'both'"
"pub", "sub", or "both".close()
Signature
get()
Signature
sub first to start receiving messages.
required
Registered topic key.
default:"1.0"
Seconds to wait for a message.
None if nothing received within timeout.
pub()
Signature
- A dict matching the ROS2 message fields (auto-converted & CDR-serialized).
- A primitive (bool, int, float) for single-field messages like
Bool. - A pre-built
pycdr2.IdlStructinstance (serialized directly). - A raw
bytesobject (published as-is).
required
Registered topic key.
required
Payload to publish.
set_named_pose()
Signature
required
Scene object name (e.g.
"box_pass_005").required
Target
(x, y, z) world position.default:"(1, 0, 0, 0)"
Target
(w, x, y, z) quaternion. Defaults to identity.sub()
Signature
get.
required
Registered topic key.
Optional
fn(msg) invoked on each message.