-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
simGetObjectPose() sometimes returns NaN #2695
Comments
This could also be due to the Actor not being found As to checking and retrying, ContainsNaN could be used for this I guess. No of retries and timeout will have to decided |
This happens every so often, particularly when I am calling
Do you mean a bug report or forum post in an Unreal bug system or forum? I haven't found any but I didn't do an exhaustive search. Here is one example of how I deal with this in one of my Python modules: def airsim_get_pose(airsim_client, object_name):
""" Get the pose of the specified object from AirSim. Run in a loop to
work around a bug where this sometimes returns nan."""
for i in range(2):
obj_pose = airsim_client.simGetObjectPose(object_name)
if (not math.isnan(obj_pose.position.x_val) and \
not math.isnan(obj_pose.position.y_val) and \
not math.isnan(obj_pose.position.z_val) and \
not math.isnan(obj_pose.orientation.x_val) and \
not math.isnan(obj_pose.orientation.y_val) and \
not math.isnan(obj_pose.orientation.z_val) and \
not math.isnan(obj_pose.orientation.w_val)):
return obj_pose
time.sleep(0.0001)
return None |
That does look quite painful. I've added a utility function in #2683 which will atleast reduce the amount of code required. |
Thanks. I'll see if I can find the underlying Unreal issue that causes this. |
@MSBGit I'm not sure if was fixed in UE 4.24.3 but I'm not getting NaN never. Can you confirm? |
This issue got fixed in PR 2898, which added an asset map and scene object map |
simGetObjectPose()
sometimes returns NaN values due to a bug in UE4 API that is used to retrieve Actor information. The common way to deal with this in client code is to retry the call tosimGetObjectPose()
a number of times until valid data is returned or until the caller decides that it has made too many calls or waited too long for valid data. It would be great if AirSim would do the retries under the hood and not require clients of AirSim to do this. Then when/if the UE4 bug is fixed, client code doesn't need to change.The text was updated successfully, but these errors were encountered: