LogicStopDriveOnSensor
Overview
Section titled “Overview”The LogicStopDriveOnSensor component automatically controls a drive based on sensor occupancy state, implementing a common conveyor control pattern where material flow stops when an object is detected and resumes when the path is clear. This component is essential for preventing collisions and managing material flow in automated production lines.
The component monitors a sensor continuously and stops the associated drive when the sensor becomes occupied, then automatically restarts the drive when the sensor clears or when an external restart signal is received.
[Screenshot: LogicStopDriveOnSensor component in Inspector showing drive and sensor assignments]
Properties
Section titled “Properties”Component References
Section titled “Component References”Drive (Drive) The drive component to control based on sensor state. When the sensor becomes occupied, this drive will be stopped by setting its JogForward property to false. When the sensor clears, the drive automatically resumes forward movement.
Sensor (Sensor) The sensor component that triggers drive control actions. The component monitors this sensor’s Occupied property to determine when to stop and start the drive. Use proximity sensors, photoelectric sensors, or any realvirtual sensor type.
PLC Signal Integration
Section titled “PLC Signal Integration”ConveyorStopped (PLCInputBool) Optional PLC input signal that reports the conveyor stop status to external systems. When the sensor becomes occupied and the drive stops, this signal is set to true, allowing external PLCs or control systems to monitor the conveyor state.
Restart (PLCOutputBool) Optional PLC output signal that provides external restart control. When this signal becomes true, the drive resumes operation regardless of sensor state, useful for manual override or external control logic integration.
Usage Examples
Section titled “Usage Examples”Basic Conveyor Control
Section titled “Basic Conveyor Control”- Setup Components: Add LogicStopDriveOnSensor to an empty GameObject in your scene
- Assign Drive: Drag the conveyor drive from the Hierarchy to the Drive field
- Assign Sensor: Drag the sensor that should trigger the stop action to the Sensor field
- Test Operation: Run the scene and observe drive stopping when objects trigger the sensor
PLC Integration Setup
Section titled “PLC Integration Setup”- Configure Stop Signal: Assign a PLCInputBool to ConveyorStopped for external system feedback
- Setup Restart Control: Assign a PLCOutputBool to Restart for external restart capability
- Interface Connection: Connect these signals to your PLC interface (OPC-UA, S7, etc.)
- Verify Communication: Test signal exchange with your external control system
Production Line Integration
Section titled “Production Line Integration”- Multiple Sensors: Use multiple LogicStopDriveOnSensor components for different conveyor sections
- Cascading Control: Connect restart signals between components for coordinated material flow
- Status Monitoring: Use ConveyorStopped signals to create a production line status dashboard
- Emergency Stops: Integrate with safety systems through external restart control
Behavior Details
Section titled “Behavior Details”Stop Logic
Section titled “Stop Logic”- Drive stops immediately when sensor transitions from unoccupied to occupied
- Stop action occurs on the first frame the sensor becomes occupied
- Drive JogForward property is set to false to stop forward movement
Restart Logic
Section titled “Restart Logic”- Drive automatically restarts when sensor transitions from occupied to unoccupied
- External restart signal (if connected) can override sensor state to force restart
- Drive JogForward property is set to true to resume forward movement
Signal Updates
Section titled “Signal Updates”- ConveyorStopped signal updates in the same frame as drive stop/start actions
- All signal updates occur in FixedUpdate for consistent timing with physics simulation
- Component optimizes performance by caching null checks during initialization
Integration Notes
Section titled “Integration Notes”Drive Compatibility
Section titled “Drive Compatibility”- Works with all realvirtual Drive types (linear drives, rotation drives, transport surfaces)
- Requires drives configured for JogForward operation mode
- Compatible with drive behaviors and advanced drive features
Sensor Requirements
Section titled “Sensor Requirements”- Compatible with all realvirtual sensor types (proximity, photoelectric, etc.)
- Requires sensors with proper Occupied property implementation
- Works with both normally open and normally closed sensor configurations
Performance Considerations
Section titled “Performance Considerations”- Optimized for real-time operation with minimal processing overhead
- Uses cached component references to avoid expensive GetComponent calls
- FixedUpdate timing ensures consistent behavior with physics simulation
Troubleshooting
Section titled “Troubleshooting”Drive Not Stopping
Section titled “Drive Not Stopping”- Verify Drive reference is assigned and drive is active
- Check that sensor Occupied property changes correctly
- Ensure drive is configured for JogForward operation
PLC Signals Not Working
Section titled “PLC Signals Not Working”- Verify PLCInputBool and PLCOutputBool references are correctly assigned
- Check interface connection status and configuration
- Test signal values in realvirtual Runtime Inspector
Timing Issues
Section titled “Timing Issues”- Component uses FixedUpdate for consistent timing with physics
- Adjust Unity Fixed Timestep if timing precision is critical
- Consider sensor detection distance and object movement speed
See Also
Section titled “See Also”- Drive - Basic drive component configuration
- Sensor - Sensor setup and configuration
- Interfaces - PLC signal integration options
- LogicMove3AxisPickAndPlace - Advanced multi-axis control
© 2025 realvirtual GmbH https://realvirtual.io - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.