@@ -11,6 +11,7 @@ import (
1111 "time"
1212
1313 "go.viam.com/rdk/logging"
14+ "go.viam.com/rdk/motionplan"
1415 "go.viam.com/rdk/motionplan/armplanning"
1516 "go.viam.com/rdk/referenceframe"
1617)
@@ -26,11 +27,17 @@ func realMain() error {
2627 ctx := context .Background ()
2728 logger := logging .NewLogger ("cmd-plan" )
2829
30+ pseudolinearLine := flag .Float64 ("pseudolinear-line" , 0 , "" )
31+ pseudolinearOrientation := flag .Float64 ("pseudolinear-orientation" , 0 , "" )
32+ seed := flag .Int ("seed" , 0 , "" )
33+
2934 flag .Parse ()
3035 if len (flag .Args ()) == 0 {
3136 return fmt .Errorf ("need a json file" )
3237 }
3338
39+ logger .Infof ("reading plan from %s" , flag .Arg (0 ))
40+
3441 content , err := os .ReadFile (flag .Arg (0 ))
3542 if err != nil {
3643 return err
@@ -43,6 +50,12 @@ func realMain() error {
4350 return err
4451 }
4552
53+ if * pseudolinearLine > 0 || * pseudolinearOrientation > 0 {
54+ req .Constraints .AddPseudolinearConstraint (motionplan.PseudolinearConstraint {* pseudolinearLine , * pseudolinearOrientation })
55+ }
56+
57+ req .PlannerOptions .RandomSeed = * seed
58+
4659 start := time .Now ()
4760
4861 plan , err := armplanning .PlanMotion (ctx , logger , & req )
@@ -76,9 +89,10 @@ func realMain() error {
7689 mylog .Printf ("\t \t \t %v" , t [c ])
7790 if idx > 0 {
7891 p := plan .Trajectory ()[idx - 1 ][c ]
79- mylog .Printf ("\t \t \t \t distances l2: %0.4f Linf %0.4f" ,
92+ mylog .Printf ("\t \t \t \t distances l2: %0.4f Linf %0.4f cartesion: %0.2f " ,
8093 referenceframe .InputsL2Distance (p , t [c ]),
8194 referenceframe .InputsLinfDistance (p , t [c ]),
95+ pp .Pose ().Point ().Distance (plan .Path ()[idx - 1 ][c ].Pose ().Point ()),
8296 )
8397 }
8498 }
0 commit comments