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

Adding support for waypoints #172

Merged
merged 15 commits into from
Jan 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update python from list logic
Ruishenl committed Jan 19, 2024
commit 3bca4c2f076b2becec8ad4b56b0e60e08576f0c8
8 changes: 4 additions & 4 deletions invertedai/common.py
Original file line number Diff line number Diff line change
@@ -171,22 +171,22 @@ class AgentAttributes(BaseModel):
def fromlist(cls, l):
if len(l) == 5:
length, width, rear_axis_offset, agent_type, waypoints = l
return cls(length=length, width=width, rear_axis_offset=rear_axis_offset, agent_type=agent_type, waypoints=waypoints)
return cls(length=length, width=width, rear_axis_offset=rear_axis_offset, agent_type=agent_type, waypoints=Point(x=waypoints[0], y=waypoints[1]))
if len(l) == 4:
if type(l[3]) == list:
if type(l[2]) == str:
length, width, agent_type, waypoints = l
return cls(length=length, width=width, agent_type=agent_type, waypoints=waypoints)
return cls(length=length, width=width, agent_type=agent_type, waypoints=Point(x=waypoints[0], y=waypoints[1]))
else:
length, width, rear_axis_offset, waypoints = l
return cls(length=length, width=width, rear_axis_offset=rear_axis_offset, waypoints=waypoints)
return cls(length=length, width=width, rear_axis_offset=rear_axis_offset, waypoints=Point(x=waypoints[0], y=waypoints[1]))
else:
length, width, rear_axis_offset, agent_type = l
return cls(length=length, width=width, rear_axis_offset=rear_axis_offset, agent_type=agent_type)
elif len(l) == 3:
if type(l[2]) == list:
length, width, waypoints = l
return cls(length=length, width=width, waypoints=waypoints)
return cls(length=length, width=width, waypoints=Point(x=waypoints[0], y=waypoints[1]))
elif type(l[2]) == str:
length, width, agent_type = l
return cls(length=length, width=width, agent_type=agent_type)