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

Upgrade setCameraOrientation to setCameraPose #2624

Closed
wants to merge 2 commits into from

Conversation

saihv
Copy link
Contributor

@saihv saihv commented Apr 25, 2020

setCameraPose now takes a pose argument instead of just orientation. Commanded pose is expected to contain position in NED, relative to default camera location.

Status:

  • Base implementation of setCameraPose for Unreal
  • Testing in Unreal
  • Unity implementation
  • Testing in Unity
  • Documentation
  • Replacements in examples/ros wrapper

@rajat2004
Copy link
Contributor

Also need to change the function in Unity

@saihv
Copy link
Contributor Author

saihv commented Apr 29, 2020

@rajat2004 I added the corresponding Unity implementation: it would be great if you can give it a shot in Unity.

@rajat2004
Copy link
Contributor

Yeah, will try to test it out today. It's a bit difficult to test Unity right now since it's currently broken in master and needs #2328 to get it running

@saihv
Copy link
Contributor Author

saihv commented May 13, 2020

@rajat2004 Hey, could you please give this a shot when you get a chance?


Args:
camera_name (str): Name of the camera to be controlled
orientation (airsim.Quaternion()): Quaternion representing the desired orientation of the camera
orientation (airsim.Pose()): Pose representing the desired position and orientation of the camera
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be Pose here

```
client.simSetCameraOrientation(0, airsim.to_quaternion(0.261799, 0, 0)); #radians
camera_pose = airsim.Pose(airsim.Vector3(0, 0, 0), airsim.to_quaternion(0.261799, 0, 0)) #RPY in radians
Copy link
Contributor

Choose a reason for hiding this comment

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

Vector3r

@rajat2004
Copy link
Contributor

rajat2004 commented May 13, 2020

@saihv Sorry for the delay. I had completed the Unity setup in the weekend but forgot to test it out

I've opened saihv#2 which is a rebased version of this PR along with extra commits to add a missing SetPose implementation in Unity and update the examples and docs along with addressing the comments above

The PR can't be merged right now, but probably after rebase should be mergeable. Or would you prefer that I open the PR directly against the master branch of this repo?

Also, is there any example script which uses this right now? I tested that there wasn't any crash or something which happened on calling this but nothing more till now. There are also problems with the Unity API right now, so can't be completely sure. Will update about any further testing

Update: Yeah, so I tested a bit more using simGetCameraInfo to get the camera pose (Removed proj matrix from the output)
I haven't yet tested any of the scripts, the only testing done is below-

>>> camera_pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(1.04, 0, 0))
>>> cl.simSetCameraPose(0, camera_pose)
>>> cl.simGetCameraInfo(0)
<CameraInfo> {   'fov': 90.0,
    'pose': <Pose> {   'orientation': <Quaternionr> {   'w_val': 0.8678191900253296,
    'x_val': 5.456392671021604e-09,
    'y_val': 0.4968801736831665,
    'z_val': 3.0586306820623577e-09},
    'position': <Vector3r> {   'x_val': 0.0,
    'y_val': 0.0,
    'z_val': -3.1441450119018555e-06}},
   
>>> camera_pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(0.2617999, 0, 0))
>>> cl.simSetCameraPose(0, camera_pose)
>>> cl.simGetCameraInfo(0)
<CameraInfo> {   'fov': 90.0,
    'pose': <Pose> {   'orientation': <Quaternionr> {   'w_val': 0.9914448857307434,
    'x_val': -5.291505900117954e-09,
    'y_val': 0.13052646815776825,
    'z_val': -6.78028300171718e-10},
    'position': <Vector3r> {   'x_val': 0.0,
    'y_val': 0.0,
    'z_val': 2.5480985641479492e-06}},
    
>>> camera_pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(0.5204, 0, 0))
>>> cl.simSetCameraPose(0, camera_pose)
>>> cl.simGetCameraInfo(0)
<CameraInfo> {   'fov': 90.0,
    'pose': <Pose> {   'orientation': <Quaternionr> {   'w_val': 0.966338574886322,
    'x_val': -5.717758710943599e-09,
    'y_val': 0.2572738528251648,
    'z_val': -1.462922227801755e-09},
    'position': <Vector3r> {   'x_val': 0.0,
    'y_val': 0.0,
    'z_val': 2.7418136596679688e-06}},

Pose is getting modified, so that should be okay I think

@rajat2004
Copy link
Contributor

@saihv I've opened #2710 since there were a lot of conflicts with your branch as well, it has your commits as well

@saihv
Copy link
Contributor Author

saihv commented May 21, 2020

Thanks @rajat2004 - haven't been able to get around to this again recently. Let's continue discussion in the updated PR

@saihv
Copy link
Contributor Author

saihv commented May 21, 2020

Closing in favor of #2710

@saihv saihv closed this May 21, 2020
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.

2 participants