Continuous-CBS icon indicating copy to clipboard operation
Continuous-CBS copied to clipboard

roadmap visualization

Open TinPLNXT opened this issue 2 years ago • 1 comments

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.

TinPLNXT avatar Feb 23 '23 11:02 TinPLNXT

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

opan08 avatar Nov 14 '24 03:11 opan08