Forum

Author Topic: How to enter Slave offset values for multicamera setups.  (Read 2918 times)

SomethingSomethingDarkside

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to enter Slave offset values for multicamera setups.
« on: December 01, 2022, 11:44:25 PM »
I am looking for a way to enter Slave offset values for a multicamera setup.

The closest I could find in the API was this.

There are 2 sensors in the setup.

Code: [Select]
chunk.sensors[1].Reference.location_enabled=True
chunk.sensors[1].Reference.enabled=True
chunk.sensors[1].Reference.location=location_vect
chunk.sensors[1].Reference.location_accuracy=location_accuracy_vect

This code doesn't seem to do anything however.

Any help would be appreciated.

ilia

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: How to enter Slave offset values for multicamera setups.
« Reply #1 on: December 02, 2022, 04:25:38 PM »
Hi Audun,

I remember having the same difficulties. This may be connected to the order of these fields set to True. Anyway, here is the code which works:

sen -- specific slave sensor, T -- transformation matrix between slave and master.

Code: [Select]
           
t = T[:3,3]
R = T[:3,:3]
omega, phi, kappa = rotmat2opk(R)

#These 2 options in GUI: Slave Offset -> switch off "Adjust location/rotation"
sen.fixed_location = False
sen.fixed_rotation = False

ref = sen.reference
ref.enabled = True
ref.location_enabled = True
ref.rotation_enabled = True

ref.location = ms.Vector(t.tolist())
ref.rotation = ms.Vector([omega, phi, kappa])

ref.location_accuracy = ms.Vector([LOC_ACCURACY_METERS] * 3)
ref.rotation_accuracy = ms.Vector([ROT_ACCURACY_DEGREES] * 3)

sen.location = ms.Vector(ref.location)
sen.rotation = ms.Matrix(R.tolist())

There could be some redundancy, but I was glad that I finally got it working, so I left it as it is :)
« Last Edit: December 02, 2022, 04:34:28 PM by ilia »

SomethingSomethingDarkside

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to enter Slave offset values for multicamera setups.
« Reply #2 on: December 05, 2022, 04:16:52 PM »
Thanks a lot for this. I was able to solve it thanks to your help.

Code: [Select]
sen=chunk.sensors[1]   
location_vect=me.Vector((0.1198,0,0))   
rotation_vect=me.Vector((-0.376965,-0.00629332,-0.209045))
location_accuracy_vect=me.Vector((0.003,0.003,0.003))   


#These 2 options in GUI: Slave Offset -> switch off "Adjust location/rotation"
sen.fixed_location = False
sen.fixed_rotation = False

ref = sen.reference
ref.enabled = True
ref.location_enabled = True
ref.rotation_enabled = True

ref.location = location_vect
ref.rotation = rotation_vect

ref.location_accuracy = location_accuracy_vect
ref.rotation_accuracy = location_accuracy_vect

#sen.location = location_vect
#sen.rotation = rotation_vect   

I ended up with this after some modification to fit my script. Last 2 lines seems to be unecessary.