Skip to content

POC to introduce two new features to Tobor#1

Open
lee-treehouse wants to merge 11 commits intomainfrom
certsy-pairing
Open

POC to introduce two new features to Tobor#1
lee-treehouse wants to merge 11 commits intomainfrom
certsy-pairing

Conversation

@lee-treehouse
Copy link
Owner

@lee-treehouse lee-treehouse commented Aug 16, 2023

This PR is a POC rather than production ready code to introduce two new features to Tobor

  • ability to add obstacles to a table
  • ability to generate a path to get from a source coordinate to a destination coordinate on a table that has obstacles
    • print the path with new command (eg IWANTTOGOTOTHERE 1,2) which is valid when the robot is already placed on the table
    • print the directions required to get there

Here is an example of the feature

for a table with

  • maximum coordinates of { x: 5, y: 4 } (attained by setting table width of 6 and length of 4))
  • obstacles at these locations as pictured below
    [
    { x: 2, y: 4 },
    { x: 2, y: 3 },
    { x: 2, y: 2 },
    { x: 3, y: 2 },
    { x: 3, y: 1 },
    { x: 4, y: 4 },
    { x: 4, y: 3 },
    { x: 4, y: 2 },
    ]

[ ] [ ] [X] [ ] [X] [ ]
[s] [ ] [X] [ ] [X] [ ]
[ ] [ ] [X] [X] [X] [d]
[ ] [ ] [ ] [X] [ ] [ ]
[ ] [ ] [ ] [ ] [ ] [ ]

  • initial PLACE at 0,3,NORTH followed by command IWANTTOGOTOTHERE 5,2 (place s and destination d pictured above)
  • the following path is produced

[ ] [ ] [X] [ ] [X] [ ]
[1] [ ] [X] [ ] [X] [ ]
[2] [ ] [X] [X] [X] [11]
[3] [ ] [ ] [X] [9] [10]
[4] [5] [6] [7] [8] [ ]

Which can be presented to the user as follows:

0,3
0,2
0,1
0,0
1,0
2,0
3,0
4,0
4,1
5,1
5,2

PLACE 0,3,NORTH
RIGHT
RIGHT
MOVE
MOVE
MOVE
LEFT
MOVE
MOVE
MOVE
MOVE
LEFT
MOVE
RIGHT
MOVE
LEFT
MOVE

Note: I included a place command in the output as a means of representing the current position before IWANTTOGOTOTHERE was executed.

As discussed this is a POC and would need some polish, a bit of simplification here and there and consideration of test strategies to accomodate different table layouts. Some reworking was also made to give commands more awareness of the table (or other 2d boundary) context and this could use some further thought and improvements.

I'd also like to make it easy for the user to easily try out different obstacle layouts which is currently very difficult.

process.env.TABLE_WIDTH = tableWidth;
process.env.TABLE_LENGTH = tableLength;
await run(logger);
// const exploreBoundaryCases = [
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporarily commented out while considering testing strategy now there are obstacles as part of the default config.

@lee-treehouse lee-treehouse changed the title DRAFT: PR to view diff and assemble evidence POC to introduce two new features to Tobor Aug 16, 2023
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

Successfully merging this pull request may close these issues.

1 participant