Mankeysocks / bikinect

Automatically exported from code.google.com/p/bikinect
0 stars 0 forks source link

z-axis mapping of joints does not work as x- and y- axes work. #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using processor type="mapped" with element type: axis="z"

What is the expected output? What do you see instead?

Graphic should change from blue to black as z-axis of joint (right hand, for 
example) is tracked. 
This does not occur by default (graphic stays blue). 
However if you add minValue and MaxVaule the bug is fixed.

In a related bug, using a filtered processing type with mapped and boolean 
nested inside, mapped graphic toggles too/from red but will not fill to blue, 
even with minValue and MaxValue defined.

Together these bugs make me think that there is something wrong with the basic 
z-axis mapping of hand joints. X and Y joints map correctly even when nested 
with filters/booleans.

What version of the product are you using? On what operating system?
Win7 x32, MappInect Beta.

Please provide any additional information below.

The following DOES WORK:
        <mapping>
            <processor type="mapped" label="Z" minValue="1000" maxValue="2000">
                <element type="joint" target="left_hand" property="position" axis="z" />
            </processor>
            <output>

            </output>
        </mapping>

The following WONT WORK:

        <mapping>
            <processor type="mapped" label="Z" minValue="1000" maxValue="2000">
                <element type="joint" target="left_hand" property="position" axis="z" />
            </processor>
            <output>

            </output>
        </mapping>

Also this WONT WORK:

        <mapping>
            <processor type="filtered" label="Z" filter="gate" inactive="standby" minValue="1000" maxValue="1500">
                <processor type="mapped">
                    <element type="joint" target="right_hand" property="position" axis="z" />
                </processor>

                <processor type="boolean" filter="less_than">
                    <element type="joint" target="right_hand" property="position" axis="y" />
                    <element type="value" value="200" />
                </processor>
            </processor>
            <output>

            </output>
        </mapping>

but this WILL WORK:
        <mapping>
            <processor type="filtered" label="Y" filter="gate" inactive="standby" minValue="-200" maxValue="200">
                <processor type="mapped">
                    <element type="joint" target="right_hand" property="position" axis="y" />
                </processor>

                <processor type="boolean" filter="less_than">
                    <element type="joint" target="right_hand" property="position" axis="y" />
                    <element type="value" value="200" />
                </processor>
            </processor>
            <output>

            </output>
        </mapping>

Original issue reported on code.google.com by KylevonH...@gmail.com on 10 Oct 2011 at 1:25

GoogleCodeExporter commented 8 years ago
***sorry, this part should have read as below***
The following WONT WORK:

        <mapping>
            <processor type="mapped" label="Z" >
                <element type="joint" target="left_hand" property="position" axis="z" />
            </processor>
            <output>

            </output>
        </mapping>

Original comment by KylevonH...@gmail.com on 10 Oct 2011 at 1:27

GoogleCodeExporter commented 8 years ago
Hi,
sorry about the late answer (had not be notified about this new issue...).

I see you digged deep into mapping ! I'm glad about that.

These problems are actually existing because the Z axis is handled EXACTLY like 
the x and y axis.
When not set, for a processor of type "mapped", the minValue is -500 and the 
maxValue is 500.

What's to be reminded is that the Kinect defines itself the origin of the 3d 
world !
So if you're kinect is placed let's say in front of you at the height your 
torso, what's at the left of your body will be negative values in the X-axis, 
what's on the right of your body will be positive values in the X axis.
In the same way, lower than your torso will be negative Y and upper will be 
positive Y values.

But for the Z axis, the 0 value is where the kinect is. So only positive values 
will be returned, because negative values would mean you have your hand behind 
the kinect !
The default values are not changed when the Z axis is chosen, so it will be 
range his values from -500 to 500, which will pretty much never happen as your 
hand will rarely be that close to the sensor.

Also, in your second example, i'm guessing you're trying to retrieve the z 
position (between 1000 and 1500) of the hand if it is below 200 in its Y 
position. What you miss there is that your minValue=1000 maxValue=1500 should 
be set to the direct parent processor that processes the element.

So your mapping should look like this :

<mapping>
    <processor type="filtered" label="Z" filter="gate" inactive="standby" >
            <processor type="mapped" minValue="1000" maxValue="1500"> <!-- minValue & maxValue are set here to process the child element -->
                <element type="joint" target="right_hand" property="position" axis="z" />
        </processor>
        <processor type="boolean" filter="less_than">
            <element type="joint" target="right_hand" property="position" axis="y" />
            <element type="value" value="200" />
        </processor>
    </processor>
    <output>
    </output>
</mapping>

Original comment by bkuperb...@gmail.com on 25 Oct 2011 at 6:31

GoogleCodeExporter commented 8 years ago
Hi Benjamin,

Thanks for your thorough response. It was helpful to think about the z-depth as 
you explained. However, I think there is still a problem with z-tracking when a 
conditional boolean is applied: check your code with MappInect on, i think you 
will see that for axis y or z, the 'blue graph' works fine as a conditional, 
but the z-tracking doesn't respond. It will turn red/blue correctly, but when 
in 'blue mode' it will not graph properly--it stays blue. If there is no 
conditional, then it graphs perfectly. I can't seem to figure that out.
Thanks for any help with that!

Original comment by KylevonH...@gmail.com on 26 Oct 2011 at 5:31

GoogleCodeExporter commented 8 years ago
Ok, i've finally understood the problem here.
It's a mixed issue between default min/max Values and overflow handling.
The overflow is by default set to "clip". That means that if no min/max value 
is defined and no overflow is defined too, the processor "mapped" will be 
clipping its value to -500 <-> 500, and the "gate" processor will try to 
process these values with no luck because it's outside its own clipping range.
It's pretty complicated because many features are involved in this issue, but i 
can give you examples that will work and end up in the same result :

1st option: set the min/max values on all the processors involved :

<mapping>
  <processor type="filtered" label="Z" filter="gate" inactive="standby" minValue="1000" maxValue="1500" > <!-- set the min/max here -->
    <processor type="mapped" minValue="1000" maxValue="1500"> <!-- ALSO set the min/max here, so that the gate processor will process the same min/max Values -->
        <element type="joint" target="right_hand" property="position" axis="z" />
    </processor>

    <processor type="boolean" filter="less_than">
        <element type="joint" target="right_hand" property="position" axis="y" />
        <element type="value" value="200" />
    </processor>
   </processor>
   <output>
   </output>
</mapping>

2nd option: force the overflow to not be handled by the mapped processor.

<mapping>
  <processor type="filtered" label="Z" filter="gate" inactive="standby" minValue="1000" maxValue="1500" > <!-- set the min/max here -->
    <processor type="mapped" overflow="none"> <!-- set overflow="none" to avoid not wanted clipping with default min/max values -->
        <element type="joint" target="right_hand" property="position" axis="z" />
    </processor>

    <processor type="boolean" filter="less_than">
        <element type="joint" target="right_hand" property="position" axis="y" />
        <element type="value" value="200" />
    </processor>
   </processor>
   <output>
   </output>
</mapping>

3rd option : use a type "direct" on the element's parent processor so value is 
only mapped on the "gate" processor :

<mapping>
  <processor type="filtered" label="Z" filter="gate" inactive="standby" minValue="1000" maxValue="1500" > <!-- set the min/max here -->
    <processor type="direct"> <!-- set type="direct" to let the "gate" processor handle the min/max mapping and clipping. Avoid double mapping/clipping conflicts -->
        <element type="joint" target="right_hand" property="position" axis="z" />
    </processor>

    <processor type="boolean" filter="less_than">
        <element type="joint" target="right_hand" property="position" axis="y" />
        <element type="value" value="200" />
    </processor>
   </processor>
   <output>
   </output>
</mapping>

--------------------------

I have commited on the SVN (rev 37) some modifications that include default 
min/max value on the Z-Axis (now set by default to 1000 --> 2000). So if you 
get the latest svn, you will be able to do something like this:

<mapping>
  <processor type="filtered" label="Z" filter="gate" inactive="standby" minValue="1000" maxValue="1500"> <!-- set the min/max here -->
    <processor type="mapped"> <!-- processor is z-axis so default min/max is 1000->2000 -->
        <element type="joint" target="right_hand" property="position" axis="z" />
    </processor>

    <processor type="boolean" filter="less_than">
        <element type="joint" target="right_hand" property="position" axis="y" />
        <element type="value" value="200" />
    </processor>
   </processor>
   <output>
   </output>
</mapping>

Hope you got what you want is these lines !

Original comment by bkuperb...@gmail.com on 26 Oct 2011 at 11:18

GoogleCodeExporter commented 8 years ago

Original comment by bkuperb...@gmail.com on 26 Oct 2011 at 11:18