1.9 KiB
1.9 KiB
Readme /pubsub
This directory represents a ROS package due to its internal structure and files. The files inside pubsub/pubsub/
are the Python scripts written by the package developer and can be called using the command line ros2 run pubsub <entry_point_name>
. The <entry_point_name>
has to be defined in setup.py.
Files
This section describes the content and purpose of the files inside this directory.
ros2 run
callable files:
- topic_talker.py : Example for creating a
MinimumPublisher
and sending topics - topic_listener.py : Example for creating a
MinimumSubscriber
and receiving topics - service_host.py : Example for creataing a
MinimumServiceProvider
and hosting a service - service_client.py : Example for creating a
MinimumServiceClient
and calling a service - statemachine_host_example.py : Example application of State Machine (SM) hosting a service to call for a change of state
- statemachine_client_example.py : Example application of a service client calling for the change of SM state
Library files:
-
*pubsub\_library* ; *pubsub\_library\_v2*
- pubsub_library_v3 : Library containing
MinimalPublisher
classMinimalSubscriber
classMinimalServiceProvider
classMinimalServiceClient
class
How to use
You can use the Minimal<X>
classes in three ways:
- Create
Minimal<X>
in your script (eg. topic_listener.py where data is echanged between the script environment and the class environment) - Implement
Minimal<X>
inside your device class the same way as implementing in your main script (<-- ToDo !!!) - Build device class upon
Minimal<X>
class (eg. statemachine_host_example.py where a device class is built upon theMinimalServiceProvider
class) by implementing this structure
class Child_Class(Parent_Class):
For example:
class StateMachineCMDServiceProvider(MinimalServiceProvider):