Hey all,
I'm working on an abstraction to control a Canon VC-C50i serial-control camera from PD. Things are going pretty well and I have the basic trigger commands done. The problem I'm running into is the continuous controls.
Lets take the pan as an example.
The documentation states that the minimum angle is 0x7c87, while the maximum is 0x8379. To set the angle of the camera I need to issue a command made of up individual bytes (converted into decimal for comport) in this case something like:
255,48,48,0,98,p,p,p,p,t,t,t,t,239 (in decimal)
Where the four P bytes are the panning angle and the four t bytes are the tilt angle.
So what I want to do is to take a range (say floats 0-1) to map to the min and max panning angle. How do I convert the miniumum angle (31879 in decimal) to four seperate decimal messages for use in the above command? Obviously I would like the granularity of the steps to be continuous so I could do some interpolation without sending invalid values.
I could sit here for a couple hours to figure it out, but I thought someone on the list would have a short cut for me.
Oh and according to the documentation (and testing) the following is correct:
Hex value | decimal message ----------+------------------ 0x7c87 = 55,67,56,55 (min) 0x8379 = 56,51,55,57 (max)
Thank you!
B.
On Wed, 20 Jul 2005, B. Bogart wrote:
I could sit here for a couple hours to figure it out, but I thought someone on the list would have a short cut for me. Oh and according to the documentation (and testing) the following is correct: Hex value | decimal message ----------+------------------ 0x7c87 = 55,67,56,55 (min) 0x8379 = 56,51,55,57 (max)
here's an external for that:
GridFlow::FObject.subclass("hexascii",1,1) { def _0_float(f) a = "%04X" % (f.to_i&0xffff) send_out 0,a[0],a[1],a[2],a[3] end }
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'
Thanks matju, and how do we do this with only PD objects?
B.
On Wed, 20 Jul 2005, B. Bogart wrote:
I could sit here for a couple hours to figure it out, but I thought someone on the list would have a short cut for me. Oh and according to the documentation (and testing) the following is correct: Hex value | decimal message ----------+------------------ 0x7c87 = 55,67,56,55 (min) 0x8379 = 56,51,55,57 (max)
here's an external for that:
GridFlow::FObject.subclass("hexascii",1,1) { def _0_float(f) a = "%04X" % (f.to_i&0xffff) send_out 0,a[0],a[1],a[2],a[3] end }
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow | | The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'
Opps, I mean (native) pd objects.
Thanks matju, and how do we do this with only PD objects?
B.
On Wed, 20 Jul 2005, B. Bogart wrote:
I could sit here for a couple hours to figure it out, but I thought someone on the list would have a short cut for me. Oh and according to the documentation (and testing) the following is correct: Hex value | decimal message ----------+------------------ 0x7c87 = 55,67,56,55 (min) 0x8379 = 56,51,55,57 (max)
here's an external for that:
GridFlow::FObject.subclass("hexascii",1,1) { def _0_float(f) a = "%04X" % (f.to_i&0xffff) send_out 0,a[0],a[1],a[2],a[3] end }
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow | | The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'
On Wed, 20 Jul 2005, B. Bogart wrote:
Thanks matju, and how do we do this with only PD objects?
Opps, I mean (native) pd objects.
Native objects... easy, you give them a reserve, alcohol, cigarette tax exemptions, and they'll do what you want.
OH, maybe you mean *this* instead!
#N canvas 0 0 344 452 10; #X obj 24 24 inlet; #X obj 24 43 t b f; #X obj 24 197 & 15; #X obj 24 138 f; #X obj 77 157 >> 4; #X obj 24 81 +; #X obj 24 100 & 3; #X msg 24 62 1; #X obj 24 119 t b f; #X obj 44 176 spigot; #X obj 24 157 t f b f; #X obj 24 216 moses 10; #X obj 24 235 + 48; #X obj 75 235 + 55; #X obj 24 260 outlet; #X connect 0 0 1 0; #X connect 1 0 7 0; #X connect 1 1 3 1; #X connect 2 0 11 0; #X connect 3 0 10 0; #X connect 4 0 3 1; #X connect 5 0 6 0; #X connect 6 0 5 1; #X connect 6 0 8 0; #X connect 7 0 5 0; #X connect 8 0 3 0; #X connect 8 1 9 1; #X connect 9 0 7 0; #X connect 10 0 2 0; #X connect 10 1 9 0; #X connect 10 2 4 0; #X connect 11 0 12 0; #X connect 11 1 13 0; #X connect 12 0 14 0; #X connect 13 0 14 0;
Be careful what you wish for...
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'