ez_interactive_marker repository

Repository Summary

Checkout URI https://github.com/neka-nat/ez_interactive_marker.git
VCS Type git
VCS Version kinetic-devel
Last Updated 2017-10-06
Dev Status UNMAINTAINED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
ez_interactive_marker 0.0.2

README

ez_interactive_marker

Build Status

Code Climate

Easily create interactive markers from yaml files.

Quick start

You can create a box with a menu by creating the following setting file.

sample:
  interactive_marker:
    name: 'simple_cube'
    header: {frame_id: 'base_link'}
    pose: {orientation: {w: 1.0}}
    controls:
      - always_visible: True
        interaction_mode: !enum [visualization_msgs/InteractiveMarkerControl, BUTTON]
        markers:
          - type: !enum [visualization_msgs/Marker, CUBE]
            scale: {x: 0.45, y: 0.45, z: 0.45}
            color: {r: 0.0, g: 0.5, b: 0.5, a: 1.0}
            pose: {orientation: {w: 1.0}}
  menu:
    - title: "menu0"
    - title: "menu1"
      children: [{title: "submenu0"}, {title: "submenu1"}]

Please execute the following command.

cd example
rosrun ez_interactive_marker ez_interactive_marker -c simple_cube.yaml

Or the following commands are publishing the configuration.

rosrun ez_interactive_marker ez_interactive_marker
# another console
cd example
rosrun ez_interactive_marker publish_config.py simple_cube.yaml

rviz_image

Supported yaml tags

It is possible to use several tags in the configuration file.

include

This tag includes the written configuration file and expand the contents.

!include sub_settings.yaml

enum

This tag expands the enum variable of the specified message module.

!enum [visualization_msgs/Marker, CUBE]

euler

This tag converts euler xyz angle to quaternion.

!euler [3.14159, 0.0, 0.0] # -> {x: 1.0, y: 0.0, z: 0.0, w: 0.0}

degrees

This tag converts degrees to radians.

!degrees 90.0 # -> 1.5708

Subscribers

Some subscribers are added when generating a interactive marker.

  • /ez_interactive_marker/<interactive marker name>/update_interactive_marker

    • Keep the interactive marker's name and update it using InteractiveMarker message.
  • /ez_interactive_marker/<interactive marker name>/update_pose

    • Update the interactive marker's pose.
  • /ez_interactive_marker/<interactive marker name>/add_control

    • Add InteractiveMarkerControl to the interactive marker.
  • /ez_interactive_marker/<interactive marker name>/remove_control

    • Delete matching InteractiveMarkerControl with InteractiveMarkerControl.name.

You can specify several commands to be executed when menu is selected.

publish topic

In the following example, the string "hello" is published to the topic of "test". Please also see this example.

menu:
  - title: "menu0"
    command:
      type: 'topic_pub'
      args:
        name: '/test'
        type: 'std_msgs/String'
        data: {data: 'Hello.'}

service call

In the following example, "add_two_ints" service is called. Please also see this example.

menu:
  - title: "menu0"
    command:
      type: 'service_call'
      args:
        name: 'add_two_ints'
        type: 'rospy_tutorials/AddTwoInts'
        data: {a: 1.0, b: 2.0}

python function

In the following example, python function is called. Please also see this example.

menu:
  - title: "loginfo"
    command:
      type: 'py_function'
      args:
        module: 'rospy'
        func: 'loginfo'
        args: {msg: 'Call rospy.loginfo!'}

Grouped check box

You can create grouped checkboxes.

menu:
  - title: "menu0"
    group: "a"
  - title: "menu1"
    group: "a"
  - title: "menu2"
    children:
      - title: "submenu0"
        group: "b"
      - title: "submenu1"
        group: "b"
      - title: "submenu2"
        group: "b"

rviz_image

In this case, menu0 and menu1 belong to group a, and submenu0, submenu1 and submenu2 belong to group b.

Check boxes are controlled exclusively within the same group.

CONTRIBUTING

No CONTRIBUTING.md found.