Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

phm_tools Tutorial

Description: This tutorial explains how to install and use the phm_tools metapackage.

Tutorial Level: INTERMEDIATE

PHM Tool Tutorials

PHM Tool tutorial consists of 2 parts. The first part covers installing and running PHM Tool. In the second part, the use case scenario tutorial for OTA (AGV) is explained.

PHM Tool Installation

This section describes how to download the dependencies required for the installation of PHM Tool and run PHM Tool.

First, a workspace needs to be created. If there is no workspace, a workspace should be created by following the instructions in the Create a workspace link.

If the workspace has been created, you should go to the workspace directory in the terminal.

$ cd ~/catkin_ws/src

Then Phm Tool is downloaded.

$ git clone "https://github.com/inomuh/phm_tools.git"

The required PyQT5 and matplotlib dependencies must be downloaded for Phm Tool to work after it is downloaded.

$ sudo apt-get install python3-pyqt5
$ sudo apt-get install python3-matplotlib

Because it is high in size, go to the rosbag file (.zip) and extract.

$ cd ~/catkin_ws/src/phm_tools/phm_rosbag
$ unzip rosbag_sample.bag.zip

After downloading the dependencies, go to the workspace and compile it.

$ cd ~/catkin_ws
$ catkin_make
$ catkin_make install

How to run the program?

After compiling the workspace, start to run PHM Tool. A new terminal is opened and roscore is opened.

$ roscore

A new terminal opens after running the roscore command. Phm Tool is run in this terminal.

$ roslaunch phm_start phm_start.launch

To configure the system, you can follow the PHM Tools User Guide document [link] or watch the videos below respectively. First video is about the Robot Design and second video is about the Robot Configuration. Sensors from rosbag should be added to the system after configuring the system.

A new terminal opens, goes to the location where rosbag is and opens the rosbag. Sensors are added to the modules as in the video.

$ cd ~/catkin_ws/src/phm_tools/phm_rosbag
$ rosbag play rosbag_sample.bag

For Task Completion Analysis, task data must come from the smach included in the simulation package. If there is no simulation, the "Task Completion Analysis" tab can be applied with the following commands.

For Predict Analysis and Prognostic Analysis in Real Time Analysis, messages must be published from /robot_task_list topc.

$ rostopic pub /robot_task_list std_msgs/String "data: '[[4.25, 2.18, 0.305032286643936], [4.25, 3.1, 0.34244299963151925], [4.25, 2.18, 0.3130261708222558], [5.55, 3.54, 0.25665934871261936], [7.29, 3.53, 0.3099463716242755], [10.34, 3.91, 0.33396332918153804], [11.05, 3.67, 0.34579751666395014], [11.42, 2.76, 0.34335229915257853], [11.42, 1.93, 0.32025931883120473], [10.97, 1.08, 0.2732565117783081], [8.16, 0.82, 0.3424904966267803], [6.35, 0.83, 0.3364506314969207], [4.26, 0.68, 0.30230026016025063]]'" -1

For Actual Analysis in Real Time Analysis section, messages from /task_time and /task_position topics must be published.

$ rostopic pub /task_time std_msgs/String "data: '[7.070728063583374, 7.325403928756714, 3.0024330615997314, 5.1106040477752686, 10.97532606124878, 12.948495864868164, 3.0029280185699463, 17.01675295829773, 3.674638032913208, 4.787661075592041, 4.183042049407959, 4.751224040985107, 16.489573001861572, 10.011996984481812, 17.285614013671875]'" -1

$ rostopic pub /task_position std_msgs/String "data: '[[4.173425111935546, 0.6996212725439405], [4.252327779615457, 1.7887780478495028], [4.254796821506879, 2.986813819580745], [4.254796821506879, 2.986813819580745], [4.075966735712705, 2.45786878651297], [5.296776265140758, 3.2377047247386685], [7.186286384259671, 3.4575905505176574], [7.186286384259671, 3.4575905505176574], [10.02707803637877, 3.834368378077772], [10.713219522235965, 3.6906226762430725], [11.321258808297841, 3.0485739135240486], [11.451096448575916, 2.271822575810481], [11.191486774449103, 1.4076532146026228], [8.491930981852743, 0.7301303113520736], [6.714700980072448, 0.7608179284539074], [4.405262763785259, 0.5861917110532081]]'" -1

Use Case Tutorial for OTA (AGV) in PHM Tool

Before run the PHM Tool for OTA, you shuould follow the instruction in Section 1.1.

Then, the simulation package must be downloaded in order to apply Task Completion Analysis. To download the simulation package, go to the workspace directory in the terminal and download the package.

$ cd ~/catkin_ws/src
$ git clone "https://github.com/inomuh/agv2_pc.git"

The required dependencies must be downloaded in order to run the simulation package after it is downloaded.

$ sudo apt-get install ros-kinetic-navigation
$ sudo apt-get install ros-kinetic-gmapping
$ sudo apt-get install ros-kinetic-timed-roslaunch
$ sudo apt-get install ros-kinetic-dynamic-reconfigure
$ sudo apt-get install ros-kinetic-smach-viewer

Since it is high in size, it goes to the meshes file in the agv2_description package (.zip) and extracts.

$ cd ~/catkin_ws/src/agv2_pc/agv2_description/meshes
$ unzip OTA-v0.7.stl.zip

GAZEBO_MODEL_PATH must be updated for the simulation to work. For this, GAZEBO_MODEL_PATH must be specified in bashrc so that the terminal is not added every time it is opened.

$ gedit ~/.bashrc

The following command should be added to the bashrc file.

export GAZEBO_MODEL_PATH=~/<WORKSPACE_NAME>/src/agv2_pc/building_editor_models:~/<WORKSPACE_NAME>/src/agv2_pc/model_editor_models:$GAZEBO_MODEL_PATH

After downloading the dependencies, go to the workspace and compile it.

$ cd ~/catkin_ws
$ catkin_make
$ catkin_make install

Programs start running after the workspace is compiled.

A new terminal is opened and roscore opens.

$ roscore

A new terminal opens after running roscore.

Phm Tool is run in this terminal.

$ roslaunch phm_start phm_start.launch

To configure the system, you can follow the PHM Tools User Guide document [link] or watch the videos in section 1.2. Sensors from rosbag should be added to the system after configuring the system.

A new terminal opens, goes to the location where rosbag is and opens the rosbag. Sensors are added to the modules as in the video.

$ cd ~/catkin_ws/src/phm_tools/phm_rosbag
$ rosbag play rosbag_sample.bag

For Task Completion Analysis, task data must come from the smach included in the simulation package. For this, simulation is opened in a new terminal.

$ roslaunch agv2_start start_phm.launch

For "Predict Analysis" and "Prognostic Analysis" which are in Real Time Analysis, messages must be published from /robot_task_list topic. For Actual Analysis section, messages should be published from /task_time and /task_position topics. In order to be publish the messages from these topics, the task should be sent to the smach from the server. There is a parser node for Smach to perform tasks from the server in a meaningful way. The parser node is opened in a new terminal.

$ rosrun agv_smach phm_task_parse.py

There are 4 different tasks that send tasks in the same format as the server. To publish these tasks to the robot, a new terminal is opened and any task below is run.

$ rosrun agv_smach phm_task_pub_1.py
$ rosrun agv_smach phm_task_pub_2.py
$ rosrun agv_smach phm_task_pub_3.py
$ rosrun agv_smach phm_task_pub_4.py

The usecase scenario for OTA is described in the PHM Tool Use Case document [link] and in the video below.

Wiki: phm_tools/Tutorials (last edited 2020-08-10 15:10:12 by ElcinErdogan)