question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Teleport strange behavior: setting "position" has no effect

See original GitHub issue

According to the current documentation for Teleport, the example code is:

controller.step(
    action="Teleport",
    position=dict(x=0.999, y=1.01, z=-0.3541),
    rotation=dict(x=0, y=90, z=0),
    horizon=30
)

However, running the following toy example:

from ai2thor.controller import Controller
controller = Controller(scene="FloorPlan_Train1_1")

# Initial pose
event = controller.step("Pass")
print("initial position:", event.metadata["agent"]["position"])
print("initial rotation:", event.metadata["agent"]["rotation"])

# Teleport (example from documentation)
event = controller.step(
    action="Teleport",
    position=dict(x=0.999, y=1.01, z=-0.3541),
    rotation=dict(x=0, y=90, z=0),
    horizon=30
)
print("position after teleport:", event.metadata["agent"]["position"])
print("rotation after teleport:", event.metadata["agent"]["rotation"])

I get:

initial position: {'x': 3.0, 'y': 0.9009997248649597, 'z': -1.5}
initial rotation: {'x': -0.0, 'y': 269.9995422363281, 'z': 0.0}
position after teleport: {'x': 3.0, 'y': 0.9009997248649597, 'z': -1.5}
rotation after teleport: {'x': -0.0, 'y': 269.9995422363281, 'z': 0.0}

So, the Teleport action is not applied.

If I do call Telepor using x, y, z arguments instead of position:

# Teleport (example from documentation)
event = controller.step(
    action="Teleport",
    x=0.999, y=1.01, z=-0.3541,
    rotation=dict(x=0, y=90, z=0),
    horizon=30
)

I still don’t observe the effect. I had to call “TeleportFull” instead of “Teleport” as follows:

event = controller.step(
    action="TeleportFull",
    x=0.999, y=1.01, z=-0.3541,
    rotation=dict(x=0, y=90, z=0),
    horizon=30
)

Then I observe an effect, but it is not expected

position after teleport: {'x': 1.25, 'y': 0.9009993672370911, 'z': -0.25}
rotation after teleport: {'x': -0.0, 'y': 90.0, 'z': 0.0}

Somehow x is set to 1.25 even though the specified value is 0.999. Same issue for y and z. EDIT: I realized this is because of the “snap to grid” behavior. That makes sense.

Could somebody check if this example works in the documentation?

In short, the documentation seems wrong, and “Teleport” seems to not work properly.

I am using ai2thor 2.7.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattdeitkecommented, Feb 22, 2021

It appears that the releases are quite frequent (understandably) and sooner or later I’ll be reading documentation that’s not for the version of ai2thor I’m running. Would be great to refer to documentation of previous versions.

This is what I’m working on now, which is one of the reasons the documentation is a tad behind what’s possible. I’ve set up the automated process from the javascript side, but basically just need to write a scraper and add comments to all Unity functions.

0reactions
mattdeitkecommented, Feb 23, 2021

With the new release of v2.7.4., Teleport and TeleportFull are now properly documented and fix the mentioned bugs. If there are any related issues, feel free to reopen 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

RigidBody2d not respecting changes in position triggered ...
Basically, if you use signals to change positions of a rigidbody2d, it doesn't work; the object teleports to the correct position for 1 ......
Read more >
[OPEN] Jumpy Animations/Sims teleport - Answers HQ
My vampire sim is teleporting by turning himself into a bat before every task, regardless of whether or not it's necessary. If it's...
Read more >
Oculus integration teleportation not working
The teleportation demo scene is acting strange. When you teleport using the thumbstick it moves you to the desired spot then to another...
Read more >
TIL Chamber doesn't actually teleport, but slides through ...
I think it's possible that the code is simply acting as a normal TP should,, changing the coordinates of the player, but because...
Read more >
Random Teleport Destinations - Editing Questions
ZDoom generalized both effects by setting up teleporters with both a destination TID and a sector tag. If only the sector tag is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found