|
# ROS Services
|
|
# ROS Services
|
|
|
|
|
|
The writer parent class takes information from a **ROS** topic and writes it to the HV Robot.
|
|
ROS Services are extensions of the writer parent class takes information from a **ROS** topic and writes it to the HV Robot. However unlike the controller, services are used to write one time messages, usually fro setting values or toggling boolians.
|
|
|
|
|
|
Writer classes subscribe to a topic, the data is taken and formatted as a message paired with a [probe](probes) that is saved to a array in the object. while the code is running, at the set interval (default 100hz) all the messages from all the probes are taken and sent to the robot. This means that the messages are always sent in a single data packet and no faster than the speed that the ros node is looping.
|
|
When a service is called the data is passed to the robot using the [writer](writer) class structure.
|
|
|
|
|
|
## Creating A Writer
|
|
## Creating A Writer
|
|
|
|
|
|
### creating the class
|
|
### creating the class
|
|
To create a new function to send data to the HV Robot, the Writer class must be extended. the child class needs to have a `__init__()` function where the *subscriber* is defined and the probe name is passed to the parent constructor; and a `callback` function where the data is formatted to be passed to the robot over the probes.
|
|
To create a new function to send data to the HV Robot, the Writer class must be extended. the child class needs to have a `__init__()` function where the *subscriber* is defined and the probe name is passed to the parent constructor; and a `callback` function where the data is formatted to be passed to the robot over the probes.
|
|
|
|
|
|
#### formatting the data
|
|
#### formatting the dataure.
|
|
The writer will take either a list of messages or a single message. if you send a single message, and there is only a single probe associated with the class, then a single probe-message tuple is created, if there are multiple probes associated with this class, then each probe is sent the same message. If a message array is passed and there are multiple probes defined, then the two arrays will be zipped together, and if they are not the same length then it will raise an exception. messages are associated to probes sequentially, so data at index 0 is paired with probe at index 0.
|
|
The writer will take either a list of messages or a single message. if you send a single message, and there is only a single probe associated with the class, then a single probe-message tuple is created, if there are multiple probes associated with this class, then each probe is sent the same message. If a message array is passed and there are multiple probes defined, then the two arrays will be zipped together, and if they are not the same length then it will raise an exception. messages are associated to probes sequentially, so data at index 0 is paired with probe at index 0.
|
|
|
|
|
|
### adding to options
|
|
### adding to options
|
... | | ... | |