PathPlanning / Continuous-CBS

Continuous CBS - a modification of conflict based search algorithm, that allows to perform actions (move, wait) of arbitrary duration. Timeline is not discretized, i.e. is continuous.
MIT License
223 stars 53 forks source link

roadmap visualization #8

Open TinPLNXT opened 1 year ago

TinPLNXT commented 1 year ago

Dear @aandreychuk,

gridmap types is possibly visualized by using the tool provided in this #7 . However, roadmap type does not seem to follow that template.

I'm struggling on simulating the results from roadmap. Any suggestion on this issue.

Thanks so much for the work.

opan08 commented 2 weeks ago

I used gpt to generate the visialization code(python version):

import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# Parse the XML file
tree = ET.parse('roadmap_task_log.xml')
root = tree.getroot()

# Extract path data and calculate cumulative duration
paths = []
for agent in root.find('log').findall('agent'):
    path_data = []
    cumulative_duration = 0.0
    for section in agent.find('path').findall('section'):
        start_i = float(section.get('start_i'))
        start_j = float(section.get('start_j'))
        goal_i = float(section.get('goal_i'))
        goal_j = float(section.get('goal_j'))
        duration = float(section.get('duration'))

        # Add start point
        path_data.append((start_i, start_j, cumulative_duration))
        cumulative_duration += duration

        # Add end point
        path_data.append((goal_i, goal_j, cumulative_duration))
    paths.append(path_data)

# Plot the paths
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111, projection='3d')

for i, path in enumerate(paths):
    x, y, z = zip(*path)
    ax.plot(x, y, z, label=f'Agent {i}')

# Set legend and labels
ax.legend()
ax.set_xlabel('X Coordinate')
ax.set_ylabel('Y Coordinate')
ax.set_zlabel('Cumulative Duration')
ax.set_title('3D Path Visualization')
plt.show()

image