interactive_markers package

Submodules

Module contents

Entry point for the ‘interactive_markers’ package.

class interactive_markers.InteractiveMarkerServer(node, namespace, *, update_pub_qos=rclpy.qos.QoSProfile, feedback_sub_qos=rclpy.qos.QoSProfile)

Bases: object

A server to one or many clients (e.g. rviz) displaying a set of interactive markers.

Note: Keep in mind that changes made by calling insert(), erase(), setCallback() etc.

are not applied until calling applyChanges().

DEFAULT_FEEDBACK_CALLBACK = 255
applyChanges()

Apply changes made since the last call to this method and broadcast to clients.

clear()

Clear all markers.

Note: This change will not take effect until you call applyChanges().

doSetPose(update, name, pose, header)

Schedule a pose update pose without locking.

erase(name)

Erase the marker with the specified name.

Note: This change will not take effect until you call applyChanges().

Parameters:

name – Name of the interactive marker.

Returns:

True if a marker with that name exists, False otherwise.

get(name)

Get marker by name.

Parameters:

name – Name of the interactive marker.

Returns:

Marker if exists, None otherwise.

getInteractiveMarkersCallback(request, response)

Process a service request to get the current interactive markers.

insert(marker, *, feedback_callback=None, feedback_type=255)

Add or replace a marker.

Note: Changes to the marker will not take effect until you call applyChanges(). The callback changes immediately.

Parameters:
  • marker – The marker to be added or replaced.

  • feedback_callback – Function to call on the arrival of a feedback message.

  • feedback_type – Type of feedback for which to call the feedback.

processFeedback(feedback)

Update marker pose and call user callback.

publish(update)

Increase the sequence number and publish an update.

setCallback(name, feedback_callback, feedback_type=255)

Add or replace a callback function for the specified marker.

Note: This change will not take effect until you call applyChanges(). The server will try to call any type-specific callback first. If a callback for the given type already exists, it will be replaced. To unset a callback, pass a value of None.

Parameters:
  • name – Name of the interactive marker

  • feedback_callback – Function to call on the arrival of a feedback message.

  • feedback_type – Type of feedback for which to call the feedback. Leave this empty to make this the default callback.

setPose(name, pose, header=std_msgs.msg.Header)

Update the pose of a marker with the specified name.

Note: This change will not take effect until you call applyChanges()

Parameters:
  • name – Name of the interactive marker.

  • pose – The new pose.

  • header – Header replacement. Leave this empty to use the previous one.

Returns:

True if a marker with that name exists, False otherwise.

shutdown()

Shutdown the interactive marker server.

This should be called before the node is destroyed so that the internal ROS entities can be destroyed.

class interactive_markers.MenuHandler

Bases: object

Creates a menu and maps its entries to function callbacks.

CHECKED = 1
NO_CHECKBOX = 0
UNCHECKED = 2
apply(server, marker_name)

Copy current menu state into the marker given by the specified name.

Divert callback for MENU_SELECT feedback to this manager.

doInsert(title, command_type, command, feedback_cb)

Insert without adding a top-level entry.

getCheckState(handle)

Get the current state of an entry.

Returns:

CheckState if the entry exists and has checkbox, None otherwise.

getTitle(handle)

Get the title for the given menu entry.

Returns:

The title, None if menu entry does not exist.

insert(title, parent=None, command_type=visualization_msgs.msg.MenuEntry.FEEDBACK, command='', callback=None)

Insert a new menu item.

makeEntry(context, handle, parent_handle)
processFeedback(feedback)

Call registered callback functions for given feedback command.

pushMenuEntries(handles_in, entries_out, parent_handle)

Create and push MenuEntry objects from handles_in onto entries_out.

Calls itself recursively to add the entire menu tree.

reApply(server)

Re-apply to all markers that this was applied to previously.

setCheckState(handle, check_state)

Specify if an entry is checked or can’t be checked at all.

setVisible(handle, visible)

Specify if an entry should be visible or hidden.