... | ... | @@ -9,10 +9,10 @@ When a service is called the data is passed to the robot using the [writer](writ |
|
|
The writer child class for a ros service is different the the writer child child class for a controller.
|
|
|
|
|
|
### 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 *service* 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 *service* is defined and the probe name is passed to the parent constructor; and a **callback** function (can be named anything since it is declared with the service) where the data is formatted to be passed to the robot over the probes using the Writer callback method, and a `stop` function that ends the service and is called when the application is shutdown.
|
|
|
|
|
|
#### 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.
|
|
|
|
|
|
### adding to options
|
|
|
All new controller classes need to be added to the options in the parser controller argument, and subsequently to the all services list as well as the controllers list in `main_node.py`. This requires creating an Enum value for the controller as well as defining it as a variable in `config.py`. finally the class needs to be added to the *cmdr* list in the `hv_client.py` constructor. |
|
|
\ No newline at end of file |
|
|
All new ros service classes need to be added to the options in the parser controller argument, and subsequently to the all services list as well as the services list in `main_node.py`. finally the class needs to be added to the *srvs* list in the `hv_client.py` constructor. |
|
|
\ No newline at end of file |