.. _ros_topic_publisher: ROS Topic Publisher/Subscriber ============================== .. image:: images/ros_topic_publisher_subscriber.png Within a ROS Node GenericDomainModel, a **ROS Topic Publisher** or **Subscriber** is represented by a **GenericDomainModelPort** with the following **Attributes.** +-------------+---------------------------------------------------+-------------------------------------------------------------+ | Attributes | Value | Description | +=============+===================================================+=============================================================+ | Type | topic | | +-------------+---------------------------------------------------+-------------------------------------------------------------+ | Attribute 0 | force_name | Use the GenericDomainModelPort's name as the ROS Topic name | +-------------+---------------------------------------------------+-------------------------------------------------------------+ | Attribute 1 | arg / arg_1_hyphen / arg_2_hyphen / param / remap | Method used to map ROS Topic names into ROS Node | +-------------+---------------------------------------------------+-------------------------------------------------------------+ | Attribute 2 | *[msg type]* | ROS Topic Msg Type *- e.g. WrenchStamped* | +-------------+---------------------------------------------------+-------------------------------------------------------------+ | 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 Topic 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 Topic name will be generated and assigned to ports in that netlist. The ROS Topic mapping method is determined by **Attribute 1**'s **Value**: **arg** or **[empty]** .. code-block:: none Unless the *[GenericDomainModelPort name]* ends with an underscore *- e.g. count_*, then the *[GenericDomainModelPort name]* is ommitted. .. code-block:: none .. note:: ROS Node args passed in will be sorted by *[GenericDomainModelPort name]* in alphanumerical order. ---- **arg_1_hypen** .. code-block:: none ---- **arg_2_hypen** .. code-block:: none ---- **param** .. code-block:: none ---- **remap** .. code-block:: none