[Documentation] [TitleIndex] [WordIndex

The simplest way

(with-ros-node ("node-name")
  (do-stuff))

with-ros-node takes care of starting up the node, running the body, then shutting everything down cleanly.

Manual starting and stopping

These are mainly useful in an interactive session. start-ros-node starts up a node and then returns. You can now interact with the ros system, set up callbacks, call services, etc. When done shutdown-ros-node brings everything down cleanly. E.g.,

ROSLISP> (start-ros-node "foo")
ROSLISP> (defvar *last-bar*)
ROSLISP> (subscribe "bar" "std_msgs/String" (store-message-in *last-bar*))
ROSLISP> (call-service "baz" 'MyService :a 3 :b 4)
12
$ *last-bar*
"the most recent string that was received"
$ (shutdown-ros-node)

Spinning

(with-ros-node ("foo" :spin t)
  (setup-callbacks))

This will spin until a control-C or similar event.

Threading model

Every topic gets its own thread. Callbacks on different topics can execute concurrently, but callbacks on the same topic happen in order. Any extra threads you create during your node's execution will have to be shutdown manually.


2024-11-16 17:43