KCL-Planning / ROSPlan

The ROSPlan framework provides a generic method for task planning in a ROS system.
http://kcl-planning.github.io/ROSPlan
BSD 2-Clause "Simplified" License
359 stars 158 forks source link

convert the plan into a PDF: #259

Closed bilal9876 closed 3 years ago

bilal9876 commented 4 years ago

I generated the plan.dot from the terminal by executing: " rostopic echo /rosplan_plan_dispatcher/plan_graph"

I copied the data from the terminal and i removed the "data:" keyword from the plan

when i tried to convert the plan into pdf by using: dot -Tpdf plan.dot > plan.pdf

" Error: plan.dot: syntax error in line 103 near "

i don't know what is the problem, really i try to modify the generated plan several times, but no solution.

the output data is not correct.

rostopic echo /rosplan_plan_dispatcher/plan_graph data: "digraph plan {\n0[ label="plan_start",style=filled,fillcolor=black,fontcolor=white];\n 1[ label="undock_start\n(kenny,wp0)"];\n2[ label="undock_end\n(kenny,wp0)"];\n 3[ label="localise_start\n(kenny)"];\n4[ label="localise_end\n(kenny)"];\n5[ \ label="goto_waypoint_start\n(kenny,wp0,wp0)"];\n6[ label="goto_waypoint_end\n (kenny,wp0,wp0)"];\n7[ label="goto_waypoint_start\n(kenny,wp0,wp1)"];\n8[ label=" goto_waypoint_end\n(kenny,wp0,wp1)"];\n9[ label="goto_waypoint_start\n(kenny,wp1,wp0)"\

rakhmanu commented 4 years ago

Hi, Please remove all "\n" in plan graph Then it will work Thank you

m312z commented 3 years ago

Hello both,

This is to do with how the topic is subscribed to. When using rostopic echo, use the argument "-p" for pretty-print. This will format correctly to your screen/file and you'll not have an issue with DOT.

Michael

m312z commented 3 years ago

Gerard has a script for generating PDF, which uses this line: rostopic echo /rosplan_plan_dispatcher/plan_graph -n 1 -p | sed "N;s/.*digraph/digraph/g" | dot -Tpdf > $OUTPUT Here's the fulle script (which we can add to the repo)

#!/bin/bash
# Usage: ./show_plan.sh <path_to_plan>.pdf
# i.e. ./show_plan.sh /tmp/my_plan.pdf

OUTPUT="/tmp/plan.pdf"
if [ ! -z "$1" ]; then
    OUTPUT=$1
fi
rostopic echo /rosplan_plan_dispatcher/plan_graph -n 1 -p | sed "N;s/.*digraph/digraph/g" | dot -Tpdf > $OUTPUT
xdg-open $OUTPUT &
echo "Esterel plan has been printed in $OUTPUT"
gerardcanal commented 3 years ago

Just added the script in a PR (#283)