Deep-Symmetry / afterglow

A live-coding lighting controller, building on the Open Lighting Architecture with Clojure and bits of Overtone.
Eclipse Public License 2.0
421 stars 23 forks source link

Figuring out pan/tilt fixture definition #23

Closed dandaka closed 5 years ago

dandaka commented 8 years ago

I am guessing right now, how to find these values:

:pan-center, :pan-half-circle, :tilt-center and :tilt-half-circle

I think there is some process, how to figure them out experimentally. If there is one, it would be good to document it.

My guess is that I have to

  1. Get down to DMX values on pan/tilt channels
  2. Experiment with values, until I have two positions on each head:
    • Head aligned to Z axis (towards audience)
    • Head aligned 180° opposite to Z axis (on tilt channel)
    • Head aligned 180° opposite to Z axis (on pan channel)
  3. Enter these values to fixtures definition
  4. Try some spatial/directional effects to see, if its working properly

Is that a correct guess?

brunchboy commented 8 years ago

Writing this up will be helpful, I have to think hard about it myself each time I do it, too. Eventually I would like to write some more software to help automate this calibration project. But, for now...

Yes, you have guessed correctly, that is the approach. First you have to decide how the light should be hung in it’s “default orientation” and document that, and then tell afterglow what angle you have hung it compared to that default orientation. But assuming you hang it at the default orientation, you can omit those angles.

You can either use OLA’s web console to adjust the pan and tilt values while you are experimenting, or set up a simple channel effect tied to a MIDI controller on the pan and tilt channels. But even then it is helpful to watch the actual DMX values in OLA.

The light may not be able to reach all those positions, some don’t pan or tilt far enough, so you enter the numbers that would reach there if DMX values could get that high.

I will write more about this on a night where I have more time. But please let me know if you have made any progress on this yourself!

dandaka commented 8 years ago

I will drop here some pieces I've found helpful, so later we could combine these into documentation.

Function to set up pan/tilt manually in the process:

(show/add-effect! :pan-head
  (afterglow.effects.channel/channel-effect
    "Pan" (params/build-variable-param :pan)
    (afterglow.channels/extract-channels
      (show/fixtures-named "head") #(= (:type %) :pan))))

(show/fixtures-named "head") — change this to fixtures you want to calibrate.

(afterglow.show/set-variable! :pan 0) — change value from 0 to the one that is opposite 180° to find :pan-half-circle

brunchboy commented 8 years ago

That looks exactly how I would have done it! :grinning: And it will be great to combine these snippets into documentation until we come up with an even more automated way to help the process. So, once the values seem right, you can test them with a direction-effect, aim-effect and/or pan-tilt-effect on the same fixtures.

Of course you will need to re-patch the fixture into the show any time you change its definition; as long as you use the same key to identify it, that will replace the previously-patched version.

dandaka commented 8 years ago

I need you to share with me a way debug fixture definitions. I did following:

1) Head aligned to Z axis (towards audience), light is going from (x 0 y 0 z 0) to (x 0 y 0 z 1). I'm not sure if I'm getting these coordinates correct. My light is pointing exactly as Show space OZ axis.

DMX value goes to :pan-center and :tilt-center in fixture definition.

2) Head aligned 180° opposite to Z axis (on tilt channel). Light is going from (x 0 y 0 z 0) to (x 0 y 0 z -1)

DMX value to :tilt-half-circle

3) Head aligned 180° opposite to Z axis (on pan channel). Light is going from (x 0 y 0 z 0) to (x 0 y 0 z -1)

DMX value to :pan-half-circle

4) Relaunch project

5)

(show/add-effect! :position
    (move/direction-effect
     "Towards z" (params/build-direction-param :x 0 :y 0 :z 1) (show/fixtures-named "head")))

Works correctly (light goes to [0;0;1])

6)

(show/add-effect! :position
    (move/direction-effect
     "Towards z" (params/build-direction-param :x 0 :y 0 :z -1) (show/fixtures-named "head")))

Isn't correct. Light points up to the ceiling. Expected: back towards the scene.

7)

(show/add-effect! :position
    (move/direction-effect
     "Towards z" (params/build-direction-param :x 0 :y -1 :z 0) (show/fixtures-named "head")))

Works correct. Light is pointing down to a dancefloor.

8)

(show/add-effect! :position
    (move/direction-effect
     "Towards z" (params/build-direction-param :x 1 :y 0 :z 0) (show/fixtures-named "head")))

Isn't corrent. Light goes to [0;0;-1], straight to the scene.

(show/add-effect! :position
    (move/direction-effect
     "Towards z" (params/build-direction-param :x -1 :y 0 :z 0) (show/fixtures-named "head")))

Isn't corrent. Light goes to [0;0;-1], straight to the scene.

dandaka commented 8 years ago

9)

(show/add-effect! :position
    (move/aim-effect
     "Towards z" (params/build-aim-param :x 0 :y 0 :z 0) (show/fixtures-named "head")))

Isn't correct. Lights point to somewhere like [5;0;0], which is a wild guess.

brunchboy commented 8 years ago

Unfortunately, it is going to be very difficult for me to help you debug this without access to one of the fixtures. Perhaps we could get on a Skype session sometime? But it looks like you are debugging it the same way that I try to, and you describe it clearly and carefully, so I will make an attempt to understand what you did and saw. And take heart, this is the very hardest part of defining a fixture, and always forces me to think hard, look at figures, rotate my hands and head, and try to remember trigonometry. That’s why I want to write a calibrator tool to help people, including myself, once I figure out how.

So I just want to confirm that I understand what you are saying. I will try to use the same step numbers as you and add thoughts and questions:

  1. When you have the fixture in the orientation you are considering the default orientation, you patch it without any rotations on any of the axes (so without any values for :x-rotation, :y-rotation, and :z-rotation—which looks correct at least based on the latest version of my-show.clj I can see on Github), and set the pan and tilt channels to 86 (:pan-center) and 35 (:tilt-center), the light is pointing directly towards you if you are facing the show. In other words, what I have called the Z axis for the show frame of reference. So far things seem good.
  2. You have not changed the orientation of the fixture itself, but as you raise the DMX value of the pan channel from 86 towards 256 (:pan-center + :pan-half-circle), the light rotates counterclockwise around the Y axis. In other words, if you are looking down at it from above, with your feet on the positive Z axis, it rotates from 6:00 through 5:00, 4:00, and stops before it quite reaches 12:00.

    Since the maximum legal DMX value is 255, and your :pan-tilt + :pan-half-circle = 256, your configuration is saying that the light cannot quite turn all the way backwards, which is possible, but seems unlikely to me.

    From reading your report again, I suspect that this is the problem: I think your light was facing 12:00 when the DMX value was 170, which would mean that :pan-half-circle should be 170 - 86, which is to say 84. That would be very similar to my lights which generally have :pan-half-circle values close to -85 (negative, because in order to make my light pan counterclockwise in my default orientation, you need to decrease the pan value).

  3. Making certain to first set the pan channel back to 86 (:pan-center) so that the light is once again facing along the positive show Z axis, start increasing the DMX value on the tilt channel from 35 (:tilt-center), and the light starts rotating counterclockwise around the X axis. (Again, if it rotates clockwise when you raise the tilt value, then your :tilt-half-circle is going to be negative.) Once you get the light facing exactly 180° from where you started, in other words, towards the negative Z axis, your DMX value is now 35 + 224, which is to say 259, which means the light can definitely not tilt 180° back. Again, I think this is probably the error, and you actually had it facing backwards at a DMX value of 224, which would mean your :tilt-half-circle value should actually be 224 - 35, or 189. (Again, if the light was turning clockwise as you raised the pan or tilt value, then negate the corresponding half-circle value.)

I really suspect that is the issue, so hopefully these changes will get it responding correctly! That would explain why it was tilting only half as far as you expected in step 6. So could you try with these changes (and double-check the signs of the half-circle values), and see if you get better results?

brunchboy commented 8 years ago

By the way, I want to say that you seem to have gotten this nearly exactly right before even asking for help, which I find very impressive. Congratulations!

brunchboy commented 8 years ago

I hope you can get access to these fixtures again, because I would love to find out how the 3D geometry stuff works for you! Also, if you have not been tracking the [afterglow "0.2.0-SNAPSHOT"] releases, you will want to update your project.clj soon, because there is some fantastic new stuff! (Also update your project to depend on [org.clojure/clojure "1.8.0"], because it has finally been released, and that is what Afterglow 0.2.0 is being built against.

So what is new? The biggest improvements that you will be able to use are in the web interface: You can now see all the effects that are running, and if any have associated cue parameters, you can adjust those right there in the web interface, including color parameters with a color picker. I need to add screen shots of that this weekend. The colors are a lot better and more readable now too, and it is easier to tell which cues are running, and which ones conflict with each other.

If you happen to have access to a Novation Launchpad Pro, it now works as well as a cue grid controller as the Ableton Push does. (And Novation is loaning me other hardware to build mappings for.)

You can also now easily map buttons on any random MIDI controller to act as smart tap tempo/beat/bar/phrase buttons and shift buttons like are present on the Push and LaunchPad Pro, and they flash on the beat like those do too. For more, see the change log. :tada:

dandaka commented 8 years ago

Wish I had more time to experiment with lights, but unfortunately all my time is family time this January. I am missing next gig with my team, no time to prepare. Video from last gig is coming soon, will notify you.

brunchboy commented 8 years ago

That’s quite understandable. Whenever you do have time to get back to experimenting, there will be even more new goodness for you. I hope the family time is going well, and look forward to the video, thank you!