|
1 | | -## TBD |
| 1 | +# HOW TO DESCRIBE ROS NODES USING THE LANGUAGE |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +Component models have two types of extensions, either .ros1 for ROS version 1 packages and .ros2 for ROS 2 packages. In both cases the language allows to describea pockage that contains ros nodes and their interfaces. |
| 6 | +To create a new model, you can easily just create a new file with the correct extension. For example my_node.ros2. |
| 7 | + |
| 8 | +## ROS (1) |
| 9 | + |
| 10 | +In ros1 the grammar is as follows: |
| 11 | +``` |
| 12 | +my_awesome_pkg: #Name of the package |
| 13 | + **fromGitRepo: ** "http://github.com/MyAccount/RepoName:BranchName" # Optional, Git reopsitory path that contains the source code |
| 14 | + **artifacts:** |
| 15 | + awesome: # Name of the artifact (as it is named in the CMakeLists) |
| 16 | + **node:** awesome_node # Name of the node |
| 17 | + **publishers:** # (Optional) List of publishers |
| 18 | + awesome_pub: |
| 19 | + **type:** "std_msgs/msg/Bool" |
| 20 | + **subscribers:** # (Optional) List of subscribers |
| 21 | + awesome_sub: |
| 22 | + **type:** "std_msgs/msg/Bool" |
| 23 | + **serviceclients:** # (Optional) List of service clients |
| 24 | + awesome_client: |
| 25 | + **type:** "std_srvs/srv/Empty" |
| 26 | + **serviceservers:** # (Optional) List of service servers |
| 27 | + awesome_server: |
| 28 | + **type:** "std_srvs/srv/Empty" |
| 29 | + **actionclients:** # (Optional) List of action clients |
| 30 | + awesome_action: |
| 31 | + **type:** "control_msgs/action/JointTrajectory" |
| 32 | + **actionservers:** # (Optional) List of action servers |
| 33 | + awesome_action: |
| 34 | + **type:** "control_msgs/action/JointTrajectory" |
| 35 | + **parameters:** # (Optional) List of parameters |
| 36 | + awesome_param: |
| 37 | + **type:** String |
| 38 | + **default:** "Hello" |
| 39 | +``` |
| 40 | + |
| 41 | + |
| 42 | +The format is based the YAML file format. All the words marked in the template with '**' are keywords that compose the model, they can't be modified. |
| 43 | + |
| 44 | + |
| 45 | +See the following model exmaple for the known teleop ROS package: |
| 46 | + |
| 47 | +``` |
| 48 | +teleop: |
| 49 | + artifacts: |
| 50 | + teleop_twist_joy_node: |
| 51 | + node: teleop_twist_joy_node |
| 52 | + publishers: |
| 53 | + cmd_vel: |
| 54 | + type: "geometry_msgs/msg/Twist" |
| 55 | + subscribers: |
| 56 | + joy: |
| 57 | + type:"sensor_msgs/msg/Joy" |
| 58 | +``` |
| 59 | + |
| 60 | +## ROS 2 |
| 61 | + |
| 62 | +The ros2 grammar is as follows: |
| 63 | +``` |
| 64 | +my_awesome_pkg: |
| 65 | + **fromGitRepo: ** "http://github.com/MyAccount/RepoName:BranchName" |
| 66 | + **artifacts:** |
| 67 | + awesome: |
| 68 | + **node:** awesome_node |
| 69 | + **publishers:** |
| 70 | + awesome_pub: |
| 71 | + **type:** "std_msgs/msg/Bool" |
| 72 | + **qos:** |
| 73 | + **depth:** 10 |
| 74 | + **durability:** volatile |
| 75 | + **history:** keep_all |
| 76 | + **profile:** default_qos |
| 77 | + **reliability:** best_effort |
| 78 | + **subscribers:** |
| 79 | + awesome_sub: |
| 80 | + **type:** "std_msgs/msg/Bool" |
| 81 | + **qos:** |
| 82 | + **depth:** 10 |
| 83 | + **durability:** transient_local |
| 84 | + **history:** keep_last |
| 85 | + **profile:** sensor_qos |
| 86 | + **reliability:** reliable |
| 87 | + **serviceclients:** |
| 88 | + awesome_client: |
| 89 | + **type:** "std_srvs/srv/Empty" |
| 90 | + **qos:** |
| 91 | + **depth:** 10 |
| 92 | + **durability:** volatile |
| 93 | + **history:** keep_all |
| 94 | + **profile:** services_qos |
| 95 | + **reliability:** best_effort |
| 96 | + **serviceservers:** |
| 97 | + awesome_server: |
| 98 | + **type:** "std_srvs/srv/Empty" |
| 99 | + **qos:** |
| 100 | + **depth:** 10 |
| 101 | + **durability:** volatile |
| 102 | + **history:** keep_all |
| 103 | + **profile:** services_qos |
| 104 | + **reliability:** best_effort |
| 105 | + **actionclients:** |
| 106 | + awesome_action: |
| 107 | + **type:** "control_msgs/action/JointTrajectory" |
| 108 | + **qos:** |
| 109 | + **depth:** 10 |
| 110 | + **durability:** volatile |
| 111 | + **history:** keep_all |
| 112 | + **profile:** default_qos |
| 113 | + **reliability:** best_effort |
| 114 | + **actionservers:** |
| 115 | + awesome_action: |
| 116 | + **type:** "control_msgs/action/JointTrajectory" |
| 117 | + **qos:** |
| 118 | + **depth:** 10 |
| 119 | + **durability:** volatile |
| 120 | + **history:** keep_all |
| 121 | + **profile:** default_qos |
| 122 | + **reliability:** best_effort |
| 123 | + **parameters:** |
| 124 | + awesome_param: |
| 125 | + **type:** String |
| 126 | + **default:** "Hello" |
| 127 | + **qos:** |
| 128 | + **depth:** 10 |
| 129 | + **durability:** volatile |
| 130 | + **history:** keep_all |
| 131 | + **profile:** parameter_qos |
| 132 | + **reliability:** best_effort |
| 133 | +``` |
| 134 | + |
| 135 | +The only remarkable difference with the ROS 1 model is that the quality of service can be defined for all the different interfaces. The quality of service atrributes are optional and they allow the following options: |
| 136 | + |
| 137 | +- depth : it must be an integer. |
| 138 | +- durability: volatile / transient_local |
| 139 | +- history: keep_all / keep_last |
| 140 | +- profile: default_qos / sensor_qos / services_qos/ parameter_qos |
| 141 | +- reliability: best_effort / reliable |
| 142 | + |
| 143 | + |
| 144 | +See the following example for the [arucos_ros](https://github.com/pal-robotics/aruco_ros) driver: |
| 145 | + |
| 146 | +``` |
| 147 | +aruco_ros: |
| 148 | + fromGitRepo: "https://github.com/pal-robotics/aruco_ros.git:humble-devel" |
| 149 | + artifacts: |
| 150 | + marker_publisher: |
| 151 | + node: marker_publisher |
| 152 | + subscribers: |
| 153 | + image_raw: |
| 154 | + type: "sensor_msgs/msg/Image" |
| 155 | + publishers: |
| 156 | + debug: |
| 157 | + type: "sensor_msgs/msg/Image" |
| 158 | + markers: |
| 159 | + type: "aruco_msgs/msg/MarkerArray" |
| 160 | + markers_list: |
| 161 | + type: "std_msgs/msg/UInt32MultiArray" |
| 162 | + result: |
| 163 | + type: "sensor_msgs/msg/Image" |
| 164 | + parameters: |
| 165 | + camera_frame: |
| 166 | + type: String |
| 167 | + image_is_rectified: |
| 168 | + type: Boolean |
| 169 | + marker_size: |
| 170 | + type: Double |
| 171 | + reference_frame: |
| 172 | + type: String |
| 173 | + raw_image_topic: |
| 174 | + type: String |
| 175 | + use_camera_info: |
| 176 | + type: Boolean |
| 177 | + use_sim_time: |
| 178 | + type: Boolean |
| 179 | + camera_info_topic: |
| 180 | + type: String |
| 181 | +``` |
| 182 | + |
| 183 | +## Textual model editor |
| 184 | + |
| 185 | +The textual editor contains checker embedded, for example: |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | +It incorporates also the auto-complete function. This is available by pressing **Ctrl** + the space bar: |
| 190 | + |
| 191 | + |
0 commit comments