Coder Social home page Coder Social logo

slider_publisher's Introduction

slider_publisher

This package proposes a slider-based publisher node similar to the joint_state_publisher, but that can publish any type of message.

Several examples are given:

  • roslaunch example.launch for timestamped Twist (cmd_vel)
  • roslaunch example.launch file:=Twist.yaml for non-timestamped Twist
  • roslaunch example.launch file:=VelPose.yaml for 2 topics (Twist + Pose)
  • roslaunch example.launch file:=MultiArray.yaml for a topic with 4 floats
  • roslaunch gazebo_service.launch for a service call (uses gazebo_msgs)

Only numerical types or their derivatives can be publisher (ie there is no text input to change such value on-the-fly). Array-based messages are also possible for numerical values.

The packages reduces to a single node that has to be called with an argument leading to a YAML file with the following structure (examples corresponding to the VelPose.yaml file):

topic_to_be_published:
    type: full message or service type               (geometry_msgs/Twist or geometry_msgs/msg/Twist to specify it is a message)
    key_as_in_gui:                        (vx)
        to: corresponding_message_field   (linear.x)
        min: slider minimum value         (-1)
        max: slider maximum value         (+1)
        default: slider default value     (if not: (min+max)/2)
    other_key:
        ...
other_topic_to_be_published:
    type...

Hard-coded numeric values (bounds / constant values in messages) can be defined using fractions of pi.

3D rotations (ie quaternions) can be parameterized as roll / pitch / yaw (see RPY.yaml). While these fields are of course not part of a Quaternion message, the corresponding 3D rotation will be built and published.

If the type is a service interface then the corresponding slider will call the service, after waiting for the server.

Parameters

  • ~rate (default 10): the rate of publication

slider_publisher's People

Contributors

okermorgant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

slider_publisher's Issues

refactor: Any chance to drop dependeny on SymPy?

out = float(eval_expr(val))

I was trying out you package and I am wondering if there is a possibility to replace line 49 with code that is not dependent on SymPy. Having to install SymPy to run your package imposes a hefty overhead that might not be required.

I personally droped "eval_expr" and I seems to work well (but did not test extensively)
For instance:

def robust_eval(val):
    if type(val) in (list,tuple):
        return [robust_eval(v) for v in val]
    if type(val) == str:    # evaluate only if can be converted to float
        try:
            # out = float(eval_expr(val))
            out = float(val)
            return out
        except:
            return val
    return float(val)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.