jvo["traj"][j][i][0] = n->x();
jvo["traj"][j][i][1] = n->y();
jvo["traj"][j][i][2] = n->h();
+ jvo["traj"][j][i][3] = n->t();
+ jvo["traj"][j][i][4] = n->s();
i++;
}
j++;
}
}
glEnd();
+ std::vector<RRTNode *> cusps;
// Plot last trajectory
if (this->tlog().size() > 0) {
glLineWidth(2);
glColor3f(0, 0, 1);
glVertex2f(GLVERTEX(n));
glVertex2f(GLVERTEX(n->parent()));
+ if (sgn(n->s()) != sgn(n->parent()->s()))
+ cusps.push_back(n);
}
}
glEnd();
}
+ // Plot cusps
+ glPointSize(8);
+ glBegin(GL_POINTS);
+ for (auto n: cusps) {
+ glColor3f(0, 0, 1);
+ glVertex2f(GLVERTEX(n));
+ }
+ glEnd();
SDL_GL_SwapWindow(gw);
for (auto n: r)
n->visit(false);
# -*- coding: utf-8 -*-
"""This scipt loads scenario and result trajectory from files and plots it."""
from json import loads
-from math import cos, pi, sin
+from math import copysign, cos, pi, sin
from matplotlib import pyplot as plt
from sys import argv
+sign = lambda x: copysign(1, x)
+
HEIGHT = 1.418
LENGTH = 4.970
SAFETY_DIST = 0
label=t["cost"][traj])
except:
print("No trajectory")
+ for i in range(len(t["traj"][-1]) - 1):
+ n1 = t["traj"][-1][i]
+ n2 = t["traj"][-1][i + 1]
+ if (sign(n1[4]) != sign(n2[4])):
+ plt.plot(n2[0], n2[1], color=COLOR["log"][1], marker=".")
plt.plot(*plot_nodes([s["init"]]), color=COLOR["start"], marker=".")
plt.plot(*plot_nodes([s["goal"]]), color=COLOR["goal"], marker=".")
# end plot here