Giter Club home page Giter Club logo

osrf_ros2_java_examples's Introduction

ROS2 Java examples

This is a collection of examples that use the Java bindings for ROS2. They aim to mimic the rclcpp examples, but using the ROS2 Java bindings. Please follow the instructions on https://github.com/esteve/ros2_java/blob/master/README.md#desktop to build the ROS2 Java bindings, you can try out any of the following examples via the ros2 command line tool:

. ~/ament_ws/install_isolated/local_setup.sh
. ~/ros2_java_ws/install_isolated/local_setup.sh
ros2 run PACKAGE_NAME SCRIPT_NAME

For example, to run the PublisherLambda and SubscriberLambda examples, open two terminals and type this on one of them to run the subscriber example:

. ~/ament_ws/install_isolated/local_setup.sh
. ~/ros2_java_ws/install_isolated/local_setup.sh
ros2 run rcljava_examples subscriber_lambda

and the following to run the publisher examples on the other terminal:

. ~/ament_ws/install_isolated/local_setup.sh
. ~/ros2_java_ws/install_isolated/local_setup.sh
ros2 run rcljava_examples publisher_lambda

you should now see a bunch of messages showing up on the first terminal. A list of all the scripts that can be run can be found in https://github.com/esteve/ros2_java_examples/blob/master/rcljava_examples/build.gradle#L28-L46

Alternatively, you can also run the examples by invoking the java command and the fully-qualified name of the class you wan to run. For example, type the following for running the SubscriberLambda example:

. ~/ros2_java_ws/install_isolated/local_setup.sh
java org.ros2.rcljava.examples.subscriber.SubscriberLambda

and this for the PublisherLambda example:

. ~/ros2_java_ws/install_isolated/local_setup.sh
java org.ros2.rcljava.examples.publisher.PublisherLambda

Publisher

  • PublisherNotComposable. An old-style publisher, resembling the ROS1 API.
  • PublisherLambda. A composable publisher that uses a lambda function and a timer to publish std_msgs.msg.String messages.
  • PublisherMemberFunction. A composable publisher that uses a member function and a timer to publish std_msgs.msg.String messages.

Subscriber

Composition

  • PublisherNode. A composable publisher node that can be reused standalone or as part of a multi-node program.
  • SubscriberNode. A composable subscriber node that can be reused standalone or as part of a multi-node program.
  • Composed. A multi-node program that runs both a SubscriberNode and a PublisherNode.

Timer

  • TimerLambda. A timer that calls a lambda function to print out a message to the console repeatedly.
  • TimerMemberFunction. A timer that calls a member function to print out a message to the console repeatedly.

Service

Client

osrf_ros2_java_examples's People

Contributors

esteve avatar jacobperron avatar gonzodepedro avatar ivanpauno avatar

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.