Difference between revisions of "Component: Collision Detector Template (Sensors)"

From Flowcode Help
Jump to navigationJump to search
(XML import - Pre 8.0 release)
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd |- | width="20%" style="color:gray;" | Version | 1.2 |- | width="20%" style="color:gray...")
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd
 
| Matrix Ltd
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.2 (Release)
+
| 1.2
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Sensors
 
| Sensors
 
|}
 
|}
  
  
 +
==Collision Detector Template component==
 +
Polls a chosen panel object to see if it has collided with another object. When collisions happen, a user notification event is generated and a pin is set or reset.  Another event is sent when the two objects separate.
  
==[[File:Component Icon fc68f857_0f97_420b_8f46_38eb56e5c8cf.png|Image]] Collision Detector Template component==
+
==Component Pack==
Polls a chosen panel object to see if it has collided with another object.
 
When collisions happen, a user notification event is generated and a pin is set
 
or reset.  Another event is sent when the two objects separate.
 
  
 +
SENSORS
  
This component can be used as a base to create ''child'' components
+
==Detailed description==
  
The following components all inherit the traits of Collision Detector Template:
+
''No detailed description exists yet for this component''
  
{| class="wikitable" width="50%"
+
==Examples==
|+|-
 
|[[File:Component Icon d79f7da1_0e33_4fba_b4a0_ac127b5a4812.png|Image]] Beam Breaker
 
|Automatically sets and resets a pin depending on whether a panel object breaks
 
the 'light beam'.
 
Can also send simulation notification events.
 
|-
 
|[[File:Component Icon 6f2c4205_6a87_46ba_a8b4_8c869e144fcd.png|Image]] Microswitch
 
|Industry standard V3 size microswitch fitter with a roller arm - activated by other panel objects
 
coming into contact with the roller.
 
Changes the state of a chip pin, and sends a simulation notification message when its
 
state changes.
 
|}
 
  
==Examples==
+
''<span style="color:red;">No additional examples</span>''
Simple example showing the collision detector component at work, when a collision is detected the direction of the motor is reversed.
 
{{Fcfile|Detector.fcfx|Detector}}
 
Simple example showing the beam break detector component at work, when a collision is detected the direction of the bouncing ball is reversed.
 
{{Fcfile|BeamBreakDemo.fcfx|Beam Break Demo}}
 
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
  
===<span style="font-weight: normal;"><u><tt>ReadState</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Get the current collision state.
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadState'''
 +
|-
 +
| colspan="2" | Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
The 'Polarity' property will affect whether a collision is represented by a high
 
  
or low state.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTarget'''
 +
|-
 +
| colspan="2" | Set the object that you want to test for collision with. If this is not called, or is called with handle = 0, collisions will be tested against every panel object that has 'Solid' status. NB) Specifying an object will save CPU power!!&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
 +
| width="90%" | Target
 +
|-
 +
| colspan="2" | The object to test for collision with.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilHigh'''
 +
|-
 +
| colspan="2" | Pause the program until the detector goes high.  'Polarity' will affect whether high value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!!&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
:[[Variable Types|BYTE]]
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilLow'''
 
+
|-
===<span style="font-weight: normal;"><u><tt>WaitUntilHigh</tt></u></span>===
+
| colspan="2" | Pause the program until the detector goes low.  'Polarity' will affect whether low value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!!&nbsp;
Pause the program until the detector goes high.
+
|-
 
+
|-
'Polarity' will affect whether high value represents a collision or separation.
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
NB) In simulation, only use this macro if testing for collision with animated or
+
|}
 
 
timer driven objects!!
 
 
 
'''Parameters'''
 
 
 
:''This macro has no parameters''
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
 
 
===<span style="font-weight: normal;"><u><tt>WaitUntilLow</tt></u></span>===
 
Pause the program until the detector goes low.
 
 
 
  'Polarity' will affect whether low value represents a collision or separation.
 
 
 
NB) In simulation, only use this macro if testing for collision with animated or
 
 
 
timer driven objects!!
 
 
 
'''Parameters'''
 
 
 
:''This macro has no parameters''
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
 
 
 
 
==Simulation macro reference==
 
 
 
===<span style="font-weight: normal;"><u><tt>SetTarget</tt></u></span>===
 
Set the object that you want to test for collision with.
 
 
 
If this is not called, or is called with handle = 0, collisions will be tested against
 
 
 
every panel object that has 'Solid' status.
 
 
 
NB) Specifying an object will save CPU power!!
 
 
 
'''Parameters'''
 
 
 
:[[Variable Types|HANDLE]] ''Target''
 
::The object to test for collision with.
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
  
  
Line 128: Line 89:
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''pin''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
The pin that should change state when objects collide or separate.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>Polarity</u></span>
+
|-
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''polarity''.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''  
Active High = Pin is high when objects collide, low when they are separate.
+
|-
 
+
|-
Active Low = Pin is low when objects collide, high when they are separate.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Pin
<span style="font-weight: normal;"><u>Test Object</u></span>
+
|-
 
+
| colspan="2" | The pin that should change state when objects collide or separate.&nbsp;
This property is of type ''Panel object'' and can be referenced with the variable name ''test_object''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
The object to test for collisions.
+
| width="90%" | Polarity
 
+
|-
A user event is sent each time this object collides with any other, or when the two object separate.
+
| colspan="2" | Active High = Pin is high when objects collide, low when they are separate. Active Low = Pin is low when objects collide, high when they are separate.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Mouse Object</u></span>
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''  
This property is of type ''Panel object'' and can be referenced with the variable name ''mouse_object''.
+
|-
 
+
|-
Choose an object that the user can clock on to simulate a collision when testing.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Test Object
<span style="font-weight: normal;"><u>Detector Ident</u></span>
+
|-
 
+
| colspan="2" | The object to test for collisions. A user event is sent each time this object collides with any other, or when the two object separate.&nbsp;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''event_id''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
An ID value to identify this particular detector.  Will be sent as the 'Ident' value for the notification
+
| width="90%" | Mouse Object
 
+
|-
events sent out so that multiple detectors can be told apart.
+
| colspan="2" | Choose an object that the user can clock on to simulate a collision when testing.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Timer Interval (ms)</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Detector Ident
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''timer_int''.
+
|-
 
+
| colspan="2" | An ID value to identify this particular detector.  Will be sent as the 'Ident' value for the notification events sent out so that multiple detectors can be told apart.&nbsp;
Time in milliseconds between collision scans.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
Small time = Greater CPU load
+
| width="90%" | Timer Interval (ms)
 
+
|-
Large time = More like to miss brief collisions.
+
| colspan="2" | Time in milliseconds between collision scans. Small time = Greater CPU load Large time = More like to miss brief collisions.&nbsp;
 +
|}

Revision as of 16:17, 7 January 2022

Author Matrix Ltd
Version 1.2
Category Sensors


Collision Detector Template component

Polls a chosen panel object to see if it has collided with another object. When collisions happen, a user notification event is generated and a pin is set or reset. Another event is sent when the two objects separate.

Component Pack

SENSORS

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Downloadable macro reference

Fc9-comp-macro.png ReadState
Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SetTarget
Set the object that you want to test for collision with. If this is not called, or is called with handle = 0, collisions will be tested against every panel object that has 'Solid' status. NB) Specifying an object will save CPU power!! 
Fc9-h32-icon.png - HANDLE Target
The object to test for collision with. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png WaitUntilHigh
Pause the program until the detector goes high. 'Polarity' will affect whether high value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!! 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png WaitUntilLow
Pause the program until the detector goes low. 'Polarity' will affect whether low value represents a collision or separation. NB) In simulation, only use this macro if testing for collision with animated or timer driven objects!! 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png Pin
The pin that should change state when objects collide or separate. 
Fc9-type-16-icon.png Polarity
Active High = Pin is high when objects collide, low when they are separate. Active Low = Pin is low when objects collide, high when they are separate. 
Fc9-conn-icon.png Simulations
Fc9-type-17-icon.png Test Object
The object to test for collisions. A user event is sent each time this object collides with any other, or when the two object separate. 
Fc9-type-17-icon.png Mouse Object
Choose an object that the user can clock on to simulate a collision when testing. 
Fc9-type-21-icon.png Detector Ident
An ID value to identify this particular detector. Will be sent as the 'Ident' value for the notification events sent out so that multiple detectors can be told apart. 
Fc9-type-21-icon.png Timer Interval (ms)
Time in milliseconds between collision scans. Small time = Greater CPU load Large time = More like to miss brief collisions.