Try it in browser Source Code Explore Other Examples
This example visualizes the path finding algorithm RRT* in a simple environment.
The algorithm finds a path between two points by randomly expanding a tree from the start point. After it has added a random edge to the tree it looks at nearby nodes to check if it's faster to reach them through this new edge instead, and if so it changes the parent of these nodes. This ensures that the algorithm will converge to the optimal path given enough time.
A detailed explanation can be found in the original paper Karaman, S. Frazzoli, S. 2011. "Sampling-based algorithms for optimal motion planning". or in this medium article.
Logging and visualizing with Rerun
All points are logged using the Points2D
archetype, while the lines are logged using the LineStrips2D
.
The visualizations in this example were created with the following Rerun code:
Map
Starting point
rr.log("map/start", rr.Points2D([start_point], radii=0.02, colors=[[255, 255, 255, 255]]))
Destination point
rr.log("map/destination", rr.Points2D([end_point], radii=0.02, colors=[[255, 255, 0, 255]]))
Obstacles
rr.log("map/obstacles", rr.LineStrips2D(self.obstacles))
RRT tree
Edges
rr.log("map/tree/edges", rr.LineStrips2D(tree.segments(), radii=0.0005, colors=[0, 0, 255, 128]))
New edges
rr.log("map/new/new_edge", rr.LineStrips2D([(closest_node.pos, new_point)], colors=[color], radii=0.001))
Vertices
rr.log("map/tree/vertices", rr.Points2D([node.pos for node in tree], radii=0.002), rr.AnyValues(cost=[float(node.cost) for node in tree]))
Close nodes
rr.log("map/new/close_nodes", rr.Points2D([node.pos for node in close_nodes]))
Closest node
rr.log("map/new/closest_node", rr.Points2D([closest_node.pos], radii=0.008))
Random points
rr.log("map/new/random_point", rr.Points2D([random_point], radii=0.008))
New points
rr.log("map/new/new_point", rr.Points2D([new_point], radii=0.008))
Path
rr.log("map/path", rr.LineStrips2D(segments, radii=0.002, colors=[0, 255, 255, 255]))
Join us on Github
rerun-io / rerun
Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui.
Build time aware visualizations of multimodal data
Use the Rerun SDK (available for C++, Python and Rust) to log data like images, tensors, point clouds, and text. Logs are streamed to the Rerun Viewer for live visualization or to file for later use.
A short taste
import rerun as rr # pip install rerun-sdk
rr.init("rerun_example_app")
rr.connect() # Connect to a remote viewer
# rr.spawn() # Spawn a child process with a viewer and connect
# rr.save("recording.rrd") # Stream all logs to disk
# Associate subsequent data with 42 on the “frame” timeline
rr.set_time_sequence("frame", 42)
# Log colored 3D points to the entity at `path/to/points`
rr.log("path/to/points", rr.Points3D(positions, colors=colors
…
Top comments (0)