Class JRosClientNode

java.lang.Object
edu.tufts.hrilab.ros2.Ros2Node
edu.tufts.hrilab.ros2.ros2jrosclient.JRosClientNode

public class JRosClientNode extends Ros2Node
Generic ROS2 node implementation using JROSClient. This may eventually be extracted to an interface so we can swap out different ros2 java implementations.
  • Field Details

    • client

      protected id.jros2client.JRos2Client client
      Pub/sub manager
    • tf

      public pinorobotics.jros2tf2.JRos2Tf2 tf
  • Constructor Details

    • JRosClientNode

      public JRosClientNode()
    • JRosClientNode

      public JRosClientNode(int domain_id)
  • Method Details

    • addAndStartSubscriber

      public void addAndStartSubscriber(Ros2Subscriber<?> sub)
      Description copied from class: Ros2Node
      Adds the specified subscriber to the node. Immediately starts listening.
      Specified by:
      addAndStartSubscriber in class Ros2Node
      Parameters:
      sub - Subscriber to add to the node.
    • end

      public void end()
      Description copied from class: Ros2Node
      Spins down the node. All publishers will stop publishing.
      Overrides:
      end in class Ros2Node
    • removeSubscriber

      public void removeSubscriber(Ros2Subscriber<?> sub)
      Description copied from class: Ros2Node
      Removes the specified subscriber from the node. TODO: Currently no jrosclient functionality for this.
      Specified by:
      removeSubscriber in class Ros2Node
      Parameters:
      sub - Subscriber to remove from the node.
    • addPublisher

      public void addPublisher(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Adds the specified publisher to the node. Does not start publishing until the publisher is started.
      Specified by:
      addPublisher in class Ros2Node
      Parameters:
      pub - Publisher to add to the node.
    • startPublisher

      public void startPublisher(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Starts publishing the specified publisher indefinitely (assuming node is spinning). The node must have been added to the node.
      Specified by:
      startPublisher in class Ros2Node
      Parameters:
      pub - Existing publisher to be started
    • startPublisher

      public void startPublisher(Ros2Publisher<?> pub, Integer iters)
      Description copied from class: Ros2Node
      Starts publishing the specified publisher for the given iterations (assuming node is pinning). The node must have been added to the node.
      Specified by:
      startPublisher in class Ros2Node
      Parameters:
      pub - Existing publisher to be started
      iters - Iterations the publisher publishes for
    • oneTimePublish

      public void oneTimePublish(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Convenience method to publish a message one time for a given publisher. Removed after use.
      Specified by:
      oneTimePublish in class Ros2Node
      Parameters:
      pub - Publisher to publish once
    • addAndStartPublisher

      public void addAndStartPublisher(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Convenience method to add and start a publisher indefinitely.
      Specified by:
      addAndStartPublisher in class Ros2Node
      Parameters:
      pub - Publisher to be added and started
      See Also:
    • addAndStartPublisher

      public void addAndStartPublisher(Ros2Publisher<?> pub, Integer iters)
      Description copied from class: Ros2Node
      Conveinece method to add and start a publisher for the given number of iterations.
      Specified by:
      addAndStartPublisher in class Ros2Node
      Parameters:
      pub - Publisher to be added and started
      iters - Number of iterations to publish for
      See Also:
    • stopPublisher

      public void stopPublisher(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Stops the given publisher from publishing. Can be started again.
      Specified by:
      stopPublisher in class Ros2Node
      Parameters:
      pub - Publisher to be stopped.
    • removePublisher

      public void removePublisher(Ros2Publisher<?> pub)
      Description copied from class: Ros2Node
      Stops and removes the publisher from the node. must be re-added to start again.
      Specified by:
      removePublisher in class Ros2Node
      Parameters:
      pub - Publisher to be stopped and removed
    • addService

      public <REQ extends id.jrosmessages.Message, RES extends id.jrosmessages.Message, DEF extends pinorobotics.jrosservices.msgs.ServiceDefinition<REQ, RES>> void addService(DEF definition, String serviceName)
      Description copied from class: Ros2Node
      Creates a service... This is definition is a nightmare. Should we just let users make this manually?
      Specified by:
      addService in class Ros2Node
    • callService

      public <REQ extends id.jrosmessages.Message, RES extends id.jrosmessages.Message> RES callService(String serviceName, REQ message)
      Specified by:
      callService in class Ros2Node
    • createTf

      public void createTf()
      Specified by:
      createTf in class Ros2Node
    • lookupTransform

      public javax.vecmath.Matrix4d lookupTransform(String from, String to)
      Specified by:
      lookupTransform in class Ros2Node
    • addAction

      public <GOAL extends id.jrosmessages.Message, RES extends id.jrosmessages.Message, DEF extends pinorobotics.jros2actionlib.actionlib_msgs.Action2Definition<GOAL, RES>> void addAction(DEF def, String actionName)
      Specified by:
      addAction in class Ros2Node
    • callAction

      public <GOAL extends id.jrosmessages.Message, RES extends id.jrosmessages.Message> RES callAction(String actionName, GOAL goal)
      Specified by:
      callAction in class Ros2Node