Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roadmap visualization #8

Open
TinPLNXT opened this issue Feb 23, 2023 · 1 comment
Open

roadmap visualization #8

TinPLNXT opened this issue Feb 23, 2023 · 1 comment

Comments

@TinPLNXT
Copy link

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
Copy link

opan08 commented Nov 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants