From 4b318197455fd1d96ac9150962fcbbb859c6f81e Mon Sep 17 00:00:00 2001 From: Bey Hao Yun Date: Tue, 26 Jul 2022 17:07:09 +0800 Subject: [PATCH 1/4] :heavy_plus_sign: :book: Added README.md for dummy_sensors ROS2 package. Verified instructions. Signed-off-by: Bey Hao Yun --- dummy_robot/dummy_sensors/README.md | 178 ++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 dummy_robot/dummy_sensors/README.md diff --git a/dummy_robot/dummy_sensors/README.md b/dummy_robot/dummy_sensors/README.md new file mode 100644 index 000000000..a363cf503 --- /dev/null +++ b/dummy_robot/dummy_sensors/README.md @@ -0,0 +1,178 @@ +## **What Is This?** + +This demo creates and runs 2 ROS2 **nodes** individually, namely `dummy_laser` and `dummy_joint_states`. + +**dummy_laser** publishes `sensor_msgs::msg::LaserScan` on a ROS2 publisher topic, `/scan`. + +**dummy_joint_states** publishes `sensor_msgs::msg::JointState` on a ROS2 publisher topic, `/joint_states`. + +Both **dummy_laser** and **dummy_joint_states** are dependencies of **dummy_robot_bringup**. Please refer to [dummy_robot_bringup](https://github.com/ros2/demos/tree/rolling/dummy_robot/dummy_robot_bringup). + +## **Build** + +```bash +cd $HOME +mkdir demo_ws/src +cd ~/demo_ws/src +git clone https://github.com/ros2/demos.git +cd ~/demo_ws +source /opt/ros//setup.bash +colcon build --packages-select dummy_sensors +``` + +## **Run** + +### **1 - dummy_laser** + +```bash +cd $HOME +cd ~/demo/src +source install/setup.bash +ros2 run dummy_sensors dummy_laser +``` + +```bash +# Terminal Output +[INFO] [1658564972.776089023] [dummy_laser]: angle inc: 0.004363 +[INFO] [1658564972.776138078] [dummy_laser]: scan size: 1081 +[INFO] [1658564972.776148752] [dummy_laser]: scan time increment: 0.000028 +``` + +### **2 - dummy_joint_states** + +```bash +cd $HOME +cd ~/demo/src +source install/setup.bash +ros2 run dummy_sensors dummy_joint_states +``` + + +## **Verify** + +A similar terminal output should be seen after running commands described in the **Run** section above: + +### **1 - dummy_laser** + +```bash +# Open new terminal. +source /opt/ros//setup.bash +ros2 topic echo /laser +``` + +```bash +# Terminal Output +--- +header: + stamp: + sec: 1658569107 + nanosec: 51491730 + frame_id: single_rrbot_hokuyo_link +angle_min: -2.356194496154785 +angle_max: 2.356194496154785 +angle_increment: 0.004363323096185923 +time_increment: 2.7777778086601757e-05 +scan_time: 0.03999999910593033 +range_min: 0.0 +range_max: 10.0 +ranges: +- 0.39602306485176086 +- 0.39602306485176086 +- 0.39602306485176086 +- 0.39602306485176086 +- 0.39602306485176086 +- 0.39602306485176086 +- 0.39602306485176086 +- '...' +intensities: [] +--- +``` + +### **2 - dummy_joint_states** + +```bash +# Open new terminal. +source /opt/ros//setup.bash +ros2 topic echo /joint_states +``` + +```bash +# Terminal Output +--- +header: + stamp: + sec: 1658569569 + nanosec: 414505214 + frame_id: '' +name: +- single_rrbot_joint1 +- single_rrbot_joint2 +position: +- -0.033653174530243454 +- -0.033653174530243454 +velocity: [] +effort: [] +--- +header: + stamp: + sec: 1658569569 + nanosec: 434418040 + frame_id: '' +name: +- single_rrbot_joint1 +- single_rrbot_joint2 +position: +- -0.13326191698696957 +- -0.13326191698696957 +velocity: [] +effort: [] +--- +header: + stamp: + sec: 1658569569 + nanosec: 454443902 + frame_id: '' +name: +- single_rrbot_joint1 +- single_rrbot_joint2 +position: +- -0.2315391504196944 +- -0.2315391504196944 +velocity: [] +effort: [] +--- +header: + stamp: + sec: 1658569569 + nanosec: 474417706 + frame_id: '' +name: +- single_rrbot_joint1 +- single_rrbot_joint2 +position: +- -0.3275029211980919 +- -0.3275029211980919 +velocity: [] +effort: [] +--- +header: + stamp: + sec: 1658569569 + nanosec: 494442418 + frame_id: '' +name: +- single_rrbot_joint1 +- single_rrbot_joint2 +position: +- -0.4201943910459491 +- -0.4201943910459491 +velocity: [] +effort: [] +--- +``` + + +## **References** + +- `sensor_msgs::msg::LaserScan` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg +- `sensor_msgs::msg::JointState` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/JointState.msg From cbc6a958ed2dc837c3229dd95c69edeffdb79ff7 Mon Sep 17 00:00:00 2001 From: Bey Hao Yun Date: Mon, 23 Jan 2023 23:57:22 +0800 Subject: [PATCH 2/4] :hammer: Adhered dummy_sensors README.md to approved style of instructions for better cross-platform-compatibility. Signed-off-by: Bey Hao Yun --- dummy_robot/dummy_sensors/README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/dummy_robot/dummy_sensors/README.md b/dummy_robot/dummy_sensors/README.md index a363cf503..d8a102611 100644 --- a/dummy_robot/dummy_sensors/README.md +++ b/dummy_robot/dummy_sensors/README.md @@ -11,12 +11,6 @@ Both **dummy_laser** and **dummy_joint_states** are dependencies of **dummy_robo ## **Build** ```bash -cd $HOME -mkdir demo_ws/src -cd ~/demo_ws/src -git clone https://github.com/ros2/demos.git -cd ~/demo_ws -source /opt/ros//setup.bash colcon build --packages-select dummy_sensors ``` @@ -25,9 +19,6 @@ colcon build --packages-select dummy_sensors ### **1 - dummy_laser** ```bash -cd $HOME -cd ~/demo/src -source install/setup.bash ros2 run dummy_sensors dummy_laser ``` @@ -41,9 +32,6 @@ ros2 run dummy_sensors dummy_laser ### **2 - dummy_joint_states** ```bash -cd $HOME -cd ~/demo/src -source install/setup.bash ros2 run dummy_sensors dummy_joint_states ``` @@ -56,7 +44,6 @@ A similar terminal output should be seen after running commands described in the ```bash # Open new terminal. -source /opt/ros//setup.bash ros2 topic echo /laser ``` @@ -92,7 +79,6 @@ intensities: [] ```bash # Open new terminal. -source /opt/ros//setup.bash ros2 topic echo /joint_states ``` From a29c3548b160a7623c1987a533a100495397ed8d Mon Sep 17 00:00:00 2001 From: Bey Hao Yun Date: Tue, 24 Jan 2023 00:23:19 +0800 Subject: [PATCH 3/4] :hammer: Updated based on feedback for correct phrasing. Signed-off-by: Bey Hao Yun --- dummy_robot/dummy_sensors/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dummy_robot/dummy_sensors/README.md b/dummy_robot/dummy_sensors/README.md index d8a102611..df03eae92 100644 --- a/dummy_robot/dummy_sensors/README.md +++ b/dummy_robot/dummy_sensors/README.md @@ -1,12 +1,13 @@ ## **What Is This?** -This demo creates and runs 2 ROS2 **nodes** individually, namely `dummy_laser` and `dummy_joint_states`. +This demo creates and runs two ROS 2 **nodes** individually, namely `dummy_laser` and `dummy_joint_states`. -**dummy_laser** publishes `sensor_msgs::msg::LaserScan` on a ROS2 publisher topic, `/scan`. +**dummy_laser** publishes `sensor_msgs::msg::LaserScan` on a ROS 2 publisher topic, `/scan`. -**dummy_joint_states** publishes `sensor_msgs::msg::JointState` on a ROS2 publisher topic, `/joint_states`. +**dummy_joint_states** publishes `sensor_msgs::msg::JointState` on a ROS 2 publisher topic, `/joint_states`. -Both **dummy_laser** and **dummy_joint_states** are dependencies of **dummy_robot_bringup**. Please refer to [dummy_robot_bringup](https://github.com/ros2/demos/tree/rolling/dummy_robot/dummy_robot_bringup). +Both **dummy_laser** and **dummy_joint_states** are dependencies of **dummy_robot_bringup**, and are usually expected to be run from the launch file there. +Please refer to [dummy_robot_bringup](https://github.com/ros2/demos/tree/rolling/dummy_robot/dummy_robot_bringup). ## **Build** From 2e9379842f40f2696cfd1f148f511d301d7fb595 Mon Sep 17 00:00:00 2001 From: Bey Hao Yun Date: Tue, 24 Jan 2023 00:32:52 +0800 Subject: [PATCH 4/4] :hammer: Updated based on feedback to adhere to language-agnostic way to refer to messages. Signed-off-by: Bey Hao Yun --- dummy_robot/dummy_sensors/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dummy_robot/dummy_sensors/README.md b/dummy_robot/dummy_sensors/README.md index df03eae92..86427271e 100644 --- a/dummy_robot/dummy_sensors/README.md +++ b/dummy_robot/dummy_sensors/README.md @@ -2,9 +2,9 @@ This demo creates and runs two ROS 2 **nodes** individually, namely `dummy_laser` and `dummy_joint_states`. -**dummy_laser** publishes `sensor_msgs::msg::LaserScan` on a ROS 2 publisher topic, `/scan`. +**dummy_laser** publishes `sensor_msgs/msg/LaserScan` on a ROS 2 publisher topic, `/scan`. -**dummy_joint_states** publishes `sensor_msgs::msg::JointState` on a ROS 2 publisher topic, `/joint_states`. +**dummy_joint_states** publishes `sensor_msgs/msg/JointState` on a ROS 2 publisher topic, `/joint_states`. Both **dummy_laser** and **dummy_joint_states** are dependencies of **dummy_robot_bringup**, and are usually expected to be run from the launch file there. Please refer to [dummy_robot_bringup](https://github.com/ros2/demos/tree/rolling/dummy_robot/dummy_robot_bringup). @@ -161,5 +161,5 @@ effort: [] ## **References** -- `sensor_msgs::msg::LaserScan` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg -- `sensor_msgs::msg::JointState` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/JointState.msg +- `sensor_msgs/msg/LaserScan` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg +- `sensor_msgs/msg/JointState` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/JointState.msg