diff --git a/add_action_server_client.sh b/add_action_server_client.sh index f0c05835e6c5f935491632ac547796af8533de7e..ac6639ed98033e60737065cbba36758d599a7ab9 100755 --- a/add_action_server_client.sh +++ b/add_action_server_client.sh @@ -123,4 +123,4 @@ else fi type="action" -fill_readme_ros_interface ${type} ${server_client} ${ros_pkg} ${action_name} ${file_pkg} ${action_file}.action \ No newline at end of file +fill_readme_ros_interface ${type} ${server_client} ${ros_pkg} ${action_name} ${file_pkg} ${action_file}.action "false" \ No newline at end of file diff --git a/add_service_server_client.sh b/add_service_server_client.sh index bfb820f416c5f205f660498ad0c3f0d2a10533e1..8d19a9f3a7c901260f58f75a8b56e86dbc889879 100755 --- a/add_service_server_client.sh +++ b/add_service_server_client.sh @@ -122,4 +122,4 @@ else fi type="service" -fill_readme_ros_interface ${type} ${server_client} ${ros_pkg} ${service_name} ${file_pkg} ${srv_file} \ No newline at end of file +fill_readme_ros_interface ${type} ${server_client} ${ros_pkg} ${service_name} ${file_pkg} ${srv_file} "false" \ No newline at end of file diff --git a/add_tf_listener_broadcaster.sh b/add_tf_listener_broadcaster.sh index 263bff1671ab991e1b9dbad40e3a7641af307cf0..dbf4b91f01f816c7ff90a876841cdfa4419440a7 100755 --- a/add_tf_listener_broadcaster.sh +++ b/add_tf_listener_broadcaster.sh @@ -96,4 +96,7 @@ then create_tf_broadcaster ${ros_pkg} ${node_h} ${node_c} ${driver_alg} else create_tf_listener ${ros_pkg} ${node_h} ${node_c} ${driver_alg} -fi \ No newline at end of file +fi + +type="topic" +fill_readme_ros_interface ${type} ${pub_subs} ${ros_pkg} "tf" "tf" "tfMessage" "true" \ No newline at end of file diff --git a/add_topic_publisher_subscriber.sh b/add_topic_publisher_subscriber.sh index 17a44615bdc82bc78a0f6646115ca7d8259a67c3..5504b8b21c6c89374fee801904e6f70b4e68c6d8 100755 --- a/add_topic_publisher_subscriber.sh +++ b/add_topic_publisher_subscriber.sh @@ -145,4 +145,4 @@ else fi type="topic" -fill_readme_ros_interface ${type} ${pub_subs} ${ros_pkg} ${topic_name} ${file_pkg} ${msg_file} \ No newline at end of file +fill_readme_ros_interface ${type} ${pub_subs} ${ros_pkg} ${topic_name} ${file_pkg} ${msg_file} "false" \ No newline at end of file diff --git a/common_templates/README.md b/common_templates/README.md index c769329714cdb632c5734e4c0cfc6d44fbcb0e4b..fdc7a68530aa086a812a320114f31b92274a57f0 100644 --- a/common_templates/README.md +++ b/common_templates/README.md @@ -8,18 +8,6 @@ Developed at Institut de Robòtica i Informà tica Industrial (IRI, CSIC-UPC) (ww Contact: labrobotica@iri.upc.edu # ROS Interface - -### Topic subscribers - -### Topic publishers - -### Service servers - -### Service clients - -### Action servers - -### Action clients ### Parameters - ~rate (Double; default: 10.0; min: 0.1; max: 1000) The main node thread loop rate in Hz. diff --git a/libraries/scripts_library.sh b/libraries/scripts_library.sh index 5b0d3a1315ba7b9d846f9f472998c314d48d7655..ad1748396783eacf175d3ca63b184368fe927a52 100755 --- a/libraries/scripts_library.sh +++ b/libraries/scripts_library.sh @@ -279,13 +279,13 @@ function add_pkg_dependency_to_readme # - $4: interface name # - $5: interface package # - $6: interface message -function fill_readme_ros_interface # ${type} ${pub_subs} ${ros_pkg} ${topic_name} ${file_pkg} ${msg_file} +function fill_readme_ros_interface # ${type} ${pub_subs} ${ros_pkg} ${topic_name} ${file_pkg} ${msg_file} ${absolute_ns} { if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]] || [[ -z $4 ]] || [[ -z $5 ]] || [[ -z $6 ]] then kill_exit "ERROR: fill_readme_ros_interface missing input parameters" fi - + #echo "fill_readme_ros_interface $1 $2 $3 $4 $5 $6" local if_type=$1 local if_subtype=$2 @@ -293,12 +293,22 @@ function fill_readme_ros_interface # ${type} ${pub_subs} ${ros_pkg} ${topic_name local if_name=$4 local if_pkg=$5 local if_msg=$6 + local absolute_ns=$7 roscd "${ros_pkg}" - file=README.md - line=" - ~$if_name ($if_pkg/$if_msg)" - comment="" + local file=README.md + local line="" + local comment="" + + echo "Filling $file with ROS Interfaces information..." + + if [ "$absolute_ns" = true ] + then + line=" - /$if_name ($if_pkg/$if_msg)" + else + line=" - ~$if_name ($if_pkg/$if_msg)" + fi case "$if_type" in "topic") @@ -310,6 +320,12 @@ function fill_readme_ros_interface # ${type} ${pub_subs} ${ros_pkg} ${topic_name "subscriber") comment="### Topic subscribers" ;; + "broadcaster") + comment="### Topic publishers" + ;; + "listener") + comment="### Topic subscribers" + ;; esac ;; "service") @@ -333,6 +349,8 @@ function fill_readme_ros_interface # ${type} ${pub_subs} ${ros_pkg} ${topic_name esac ;; esac + + add_line_to_file "${comment}" "# ROS Interface" "${file}" add_line_to_file "${line}" "${comment}" "${file}" } @@ -417,7 +435,8 @@ function add_line_to_file if [[ -z "${line_found}" ]] then - sed -i -e "/${comment}/a\\${line_to_add}" "${file}" + #echo "Adding line after comment: ${line_to_add} after ${comment_to_find}" + sed -i -e "/${comment_to_find}/a\\${line_to_add}" "${file}" else #skip line echo "File ${file} already included the line, skipping..."