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

How to get/set the ground truth for gates sizes? #28

Closed
yannbouteiller opened this issue Aug 10, 2019 · 13 comments
Closed

How to get/set the ground truth for gates sizes? #28

yannbouteiller opened this issue Aug 10, 2019 · 13 comments

Comments

@yannbouteiller
Copy link

yannbouteiller commented Aug 10, 2019

Hello everyone,

According to the competition guidelines, for difficulties medium and hard, the sizes of the gates will not be constant. How do we get the ground truth for these, please? I am basically simply trying to detect when the drone passes through a gate.

Also, is it possible to change these dimensions algorithmically?

Thanks,
Yann.

@yannbouteiller yannbouteiller changed the title How to get the ground truth for gates sizes? How to get/set the ground truth for gates sizes? Aug 10, 2019
@madratman
Copy link
Contributor

madratman commented Aug 10, 2019

See discussion here and here
and get_ground_truth_gate_poses() in baseline_racer.py
The python API is documented here

allow us to get back wrt changing gate dimensions

@yannbouteiller
Copy link
Author

Thank you for quick reply madratman, however I think I missed something. Don't the gate poses only contain their orientation and position ?

@madratman
Copy link
Contributor

ah, sorry. I misread your question. We'll get back with an answer soon.

@yannbouteiller
Copy link
Author

yannbouteiller commented Aug 10, 2019

(By the way for my gate-passing detector I am trying to understand how AirSim uses quaternions for object orientation and the get_gate_facing_vector_from_quaternion() function in the baseline sounds quite strange to me. You might want to try this instead:

def get_gate_facing_vector_from_quaternion_with_multiplication(quat):
v = airsim.Vector3r(0.0,1.0,0.0)
vq = v.to_Quaternionr()
res = quat * vq * quat.conjugate()
return airsim.Vector3r(res.x_val,res.y_val,res.z_val)

Also I think you might have a small bug here because it returns a 4x4 identity numpy array instead of a 3x1 Vector3r when n < eps.)

@madratman
Copy link
Contributor

madratman commented Aug 11, 2019

Ah, yeah, that's a bug for sure, I should be returning Vector3r(0,1,0) in the edge case. Thanks for pointing it out.
W.r.t. how the gate vector is calculated: I am first converting the quaternion representing the gate orientation in the world frame to a rotation matrix. Then, I am returning the 2nd column of that rotation matrix. The 3 columns of a rotation matrix represent the i,j,k / x,y,z basis vectors. In the unreal project, the gate mesh is set such that the gate facing vector is (0,1,0) or "j", in the gate frame.
I think quat * (0,1,0) * q.conj() is gonna give you the same answer.

saihv pushed a commit to saihv/AirSim-NeurIPS2019-Drone-Racing that referenced this issue Aug 16, 2019
@madratman
Copy link
Contributor

ah, we forgot to add the nominal sizes of the gates

@madratman madratman reopened this Aug 23, 2019
@yannbouteiller
Copy link
Author

File "/home/yann/Desktop/GoD/Algorithm/rewardfunction.py", line 136, in get_ground_truth_gate_poses
    s = self.airsim_client.simGetObjectScale(object_name=gate_name)
  File "/home/yann/anaconda3/lib/python3.7/site-packages/airsimneurips/client.py", line 242, in simGetObjectScale
    scale = self.client.call('simGetObjectScale', object_name)
  File "/home/yann/anaconda3/lib/python3.7/site-packages/msgpackrpc/session.py", line 41, in call
    return self.send_request(method, args).get()
  File "/home/yann/anaconda3/lib/python3.7/site-packages/msgpackrpc/future.py", line 45, in get
    raise error.RPCError(self._error)
msgpackrpc.error.RPCError: rpclib: server could not find function 'simGetObjectScale' with argument count 1.

Is this normal then? I can use the reset/start track API with not too many issues but I get this error with the simGetObjectScale() function.

@madratman
Copy link
Contributor

uh, I just noticed simSet/GetObjectScale is missing in the linux and windows binaries both, coz of some errors on our side. Will update in v0.2.1

@paulerikf
Copy link

Did I understand that in Teir 3 you are allowed to get the ground truth sizes of gates?

@yannbouteiller
Copy link
Author

I don't think so, but I need that for training purpose.

@msb336
Copy link
Contributor

msb336 commented Aug 29, 2019

@yannbouteiller
Linux release binaries have been updated to contain the scale APIs. If you redownload AirSim.tar.gz you will be able to use said APIs.

Also, I just removed the pass-through light bulb triggers from the linux release environments and fixed some lighting issues in the B99 environment, so it might be worth redownloading the environment paks as well.

@madratman
Copy link
Contributor

madratman commented Sep 6, 2019

my previous answer was wrong. see edited:

with scale 1: the gate dimensions are :

  • inner dimensions (width, thickness, height) 1.6m x 0.2 m x 1.6 m
  • outer dimensions (width, thickness, height): 2.1333 m x 0.2 m x 2.1333 m

You can use the return of simGetObjectScale() and multiply that with these numbers and change them with simSetObjectScale()

Now, in soccer_field_easy, for example, the gates are scaled with (1.5, 1.0, 1.5) in width , thickness, height, leading to a corresponding gate inner as (2.4m x 0.2 m x 2.4 m) and gate outer dimensions as (3.2m x 0.2m x 3.2m). see pics below

dimension_2
dimension

here's a snippet

import airsimneurips
c = airsimneurips.MultirotorClient()
c.confirmConnection()
c.simLoadLevel('Soccer_Field_Easy')
gate_obj_list = c.simListSceneObjects("Gate.*")
# returns ['Gate00', 'Gate01', 'Gate02', 'Gate03', 'Gate04', 'Gate05', 'Gate06', 'Gate07', 'Gate08', 'Gate09', 'Gate10_21', 'Gate11_23']
c.simGetObjectScale(gate_obj_list[0])
# returns <Vector3r> {   'x_val': 1.5, 'y_val': 1.0, 'z_val': 1.5}
# corresponding to dimensions in pic above 
c.simSetObjectScale(gate_obj_list[0], Vector3r(2.0, 1.0, 3.0))

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

4 participants