[Documentation] [TitleIndex] [WordIndex

Publishing

First create a publication:

(defvar pub (advertise "chatter" "std_msgs/String"))

Then publish messages to it:

(let ((m (make-msg "std_msgs/String" :data "foo")))
  (publish pub m))

You can also avoid creating the object explicitly:

(publish-msg pub :data "bar")

Subscribing

Create a callback:

(subscribe "chatter" "std_msgs/String" #'print)

The callback argument is any function of one argument.

A useful callback-generator is store-message-in, e.g.

(defvar *last-message*)
(subscribe "chatter" "std_msgs/String" (store-message-in *last-message*))

2021-12-25 12:59