ROS Service Server/Client¶
Within a ROS Node GenericDomainModel, a ROS Service Server or Client is represented by a GenericDomainModelPort with the following Attributes.
| Attributes | Value | Description |
|---|---|---|
| Type | service | |
| Attribute 0 | force_name | Use the GenericDomainModelPort’s name as the ROS Service name |
| Attribute 1 | arg / arg_1_hyphen / arg_2_hyphen / param / remap | Method used to map ROS Service names into ROS Node |
| Attribute 2 | [msg type] | ROS Service Msg Type - e.g. Trigger |
| Attribute 7 | ros |
If the CyPhy Master Interpreter is run, these Attributes will be used to populate the parent ROS Node Model’s corresponding node element in the generated ROS .launch file.
For each netlist of connected ports, the Interpreter will check that the the port types all match (e.g. a ROS Topic Publisher cannot broadcast to a ROS Service Server) and that the Service Msg types (if specified) all match.
If a port’s Attribute 0 Value is force_name, then all ports on that netlist will be assigned the forcing GenericDomainModelPort’s name. If two or more ports have their Attribute 0 Value set to force_name, then one of their names will be picked at random and assigned to all ports on that netlist. Be careful using force_name.
Otherwise, a unique ROS Service name will be generated and assigned to ports in that netlist.
The ROS Service mapping method is determined by Attribute 1’s Value:
arg or [empty]
<node name=... pkg=... type=...
args="[GenericDomainModelPort name] [service_name] ..."
/>
Unless the [GenericDomainModelPort name] ends with an underscore - e.g. count_, then the [GenericDomainModelPort name] is ommitted.
<node name=... pkg=... type=...
args="[service_name] ..."
/>
Note
ROS Node args passed in will be sorted by [GenericDomainModelPort name] in alphanumerical order.
arg_1_hypen
<node name=... pkg=... type=...
args="-[GenericDomainModelPort name] [service_name] ..."
/>
arg_2_hypen
<node name=... pkg=... type=...
args="--[GenericDomainModelPort name] [service_name] ..."
/>
param
<node name=... pkg=... type=... >
<param name="[GenericDomainModelPort name]" value="[service_name]" />
</node>
remap
<node name=... pkg=... type=... >
<remap from="[GenericDomainModelPort name]" to="[service_name]" />
</node>