diff --git a/pps_wiki/pics/custom_controller_src.png b/pps_wiki/pics/custom_controller_src.png index 4d76132f65581637e4910a9083a8375c7fec5fc4..f4e1924bd5720e2e3ee57191d3f7b7b81e8cedf9 100644 Binary files a/pps_wiki/pics/custom_controller_src.png and b/pps_wiki/pics/custom_controller_src.png differ diff --git a/pps_wiki/pics/rqt_window_subplots.png b/pps_wiki/pics/rqt_window_subplots.png new file mode 100644 index 0000000000000000000000000000000000000000..fa0412d32f7874c9635d58ba448d51a2bd1f2b31 Binary files /dev/null and b/pps_wiki/pics/rqt_window_subplots.png differ diff --git a/pps_wiki/workflow_for_students.md b/pps_wiki/workflow_for_students.md index 1206e85b5cf760693afefeb3d9ec5a82c6660619..d1ca0f9457a28d430505f2eb74ff34bb191d46f8 100644 --- a/pps_wiki/workflow_for_students.md +++ b/pps_wiki/workflow_for_students.md @@ -208,6 +208,34 @@ to it* the GUI. This way, you can try and see the effect of changing some parameters on the fly. + +#### Steps to plot debug variables from Custom Controller in a graph + +1. Choose the variables that we want to see in a plot from the file + `CustomControllerService.cpp`. Inside the function `calculateControlOutput`, + a part where we fill a DebugMsg with data has been written (lines 133-145 in + previous figure). Vicon data has already been filled in (vicon\_x, + vicon\_y,...). Additionally, there are up to 10 general purpose variables + that can be filled with any data we may be interested in plotting (value\_1, + value\_2,...., value\_10). <br><br> +2. Once chosen the variables, save the file and go to `cd ~/work/D-FaLL-System/pps_ws` and write `catkin_make`.<br><br> +3. Open another terminal and type `rqt`. Then, in the top bar, go to + Plugins->Visualization->Plot. A new plot will be added to the screen. If you + want more than one plot, just add several ones doing the same thing. You will + be seeing something like this:<br><br> + + <img src="./pics/rqt_window_subplots.png" style="width: 400px;"/> <br><br> +4. In each subplot, to add data to plot, write the name of the topic you want to + plot in the field "Topic", e.g., if we want to plot the Z position of our + crazyflie, we would have to write here + `/<student_id>/CustomControllerService/DebugTopic/vicon_z`. You can see an + autocompletion of the + list of all the topics available when you start typing in the field "Topic". <br><br> +3. Start the Student node following the steps mentioned before (`roslaunch + d_fall_pps Student.launch`) and enable the Custom Controller.<br><br> +4. Once we are using the Custom Controller, we will be seeing how the data + selected gets plotted in the rqt plots. + <!-- --- --> diff --git a/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp b/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp index ae92d62fced18257d70504713b62966722535010..eb81b2f642d1cc059a3edaeea20acabf49003643 100644 --- a/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp +++ b/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp @@ -129,7 +129,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response & // ROS_INFO_STREAM("Delta t: " << request.ownCrazyflie.acquiringTime); - // ************ Fill the debugging message with information to be displayed in rqt_plot **************** + // ************ Fill the debugging message with information to be displayed in rqt plots **************** DebugMsg debugMsg; debugMsg.vicon_x = request.ownCrazyflie.x; debugMsg.vicon_y = request.ownCrazyflie.y;