The Rotary Encoder is a component that simulates a physical encoder.
It consists of two components; Physical and Logic. Both are needed to control the motor through a logic adapter (connecting the Rotary Encoder to an external controller through a https://unit040.atlassian.net/wiki/spaces/PUD/pages/280987237 ). Adding a Control Panel gives you the option to control the encoder from the Unity scene.
The Rotary Encoder can be found under Standard Components > Rotary Encoder
It will automatically be attached to a selected GameObject or otherwise it will create a new GameObject to attach to.
A https://unit040.atlassian.net/wiki/spaces/PUD/pages/281673729 will be created automatically as part of the component.
Current value of the Rotary Encoder
Important: The Rotary Encoder only functions in play mode and thus only shows data in play mode
Assign the Wheel Joint you wish to use for the Rotary Encoder
Value Per Rotation
The value difference for a full rotation on the Wheel Joint
The minimum value at zero position
Enables rounding the output to certain intervals
Enables the use of a minimum and maximum value
The minimum value of the output value
The maximum value of the output value
On Value Changed ()
UnityEvent that is fired as soon as the output value changes
In the Control Panel tab you can generate a Control Panel for the Rotary Encoder.
Create a Rotary Encoder and setup its Wheel Joint
Add a Kinematics Controller, this can be found under Mechanics > Add Kinematics > Kinematics Controller to a separate GameObject
Make sure the Rotary Encoder is parented under the Kinematic Controller in the Hierarchy
Set the desired settings for the Rotary Encoder
Enter PlayMode and test whether the Rotary Encoder works
Select a Rotary Encoder Component to connect to the PLC
Input and Output from connected PLC
The corresponding value from the connected PLC
PLC Settings & Debugging
These settings are general Logic Component settings. Look at the Logic Component Documentation for more details.
Look at the https://unit040.atlassian.net/wiki/spaces/PUD/pages/280988469 for an example of how to connect a Rotary Encoder to an external controller.