Reading Joint Values of Mechanisms

In simulation, you can read the joint values of mechanisms with the Read Joint activity.

The units of the joint magnitude (that is to say length and angle) are the units defined in the Parameters and Measure options.

Note: This command is only available if a Motion Controller is associated to the mechanism.

Refer to the Assembly Design user guide for the creation and the edition of mechanisms.

Refer to the Device Designer user guide for the creation and the edition of mechanisms.

Note: The Read Joint activity does not give the joint value of the current cycle but the value of the previous cycle.

This task shows you how to:


Before you begin: The System and Device Designer workbench should be opened.
Related Topics
About Live Simulation
Writing Command Values of Mechanisms

Read Joint in SFC+

You can program a Read Joint activity in SFC+.

  1. Open a device that has a previously-defined mechanism, motion controller and simulation logic. The Main block must be a SFC+ block (see a typical example below).



  2. To open the SFC+ Editor, do one of the following:

    • Expand the content of the Main block and double-click Behavior.
    • Right-click the Main block and select Behavior Editor.
    • Select Behavior Editor in the Main window toolbar.




    • The SFC+ Editor appears as an immersive window at the center of the screen.
    • A toolbox containing all the SFC+ Editor commands appears at the right side of the screen.

    Note: In our example, the resource logic is undefined, so the editor is empty.

  3. Select Read Joint in the Activities toolbar and click the 2D immersive window to position the Kinematics Motion action.

    The Read Joint Properties dialog box appears:


    • In the Data frame, you can define the value of one joint.
    • In the Declaration frame, you can choose to create the port or the signal used in the Value box.
    • In the Action frame, you can define the settings of the Read Joint action.

  4. Enter Rail_Joint in the value field. That means that the Prismatic.1 joint value will be assigned to the Rail_Joint signal.

  5. Click As Port.

    The Rail_Joint port will be created with the activity.

  6. Click Sustain.

    The Read Joint activity will be executed at each cycle the step is active.

  7. Click OK.

    The step S0 is created in the SFC+ graph. The action calling the Read Joint activity is identified by the icon and the joint name.

    Tip: To have more details about the action, scroll-over it to display the tool tip.

  8. Create a new Read Joint activity to retrieve the value of the Prismatic.2 joint.

    1. Select Read Joint in the Activities toolbar and click the step S0 in the SFC+ editor.

      The Read Joint Properties dialog box appears.

    2. Enter Filler_Joint in Value and select Prismatic.2 in the list.
    3. Click As Port.
    4. Click Sustain.
    5. Click OK.



    A new Read Joint action is added to the step S0.

  9. Close the SFC+ Editor window.

    Tip: To modify the Read Joint action, double-click it. The Read Joint Properties dialog box appears. Then, you can change the selected joint.

  10. To test the behavior of the activities in simulation:

    1. Select the Main block in the Simulation Logic tree and click the Play of the compass.

      The block is compiled and the simulation is initialized. The Simulation toolbar and the Signals Monitoring window appear.

    2. Expand the ports of the Main block in the Signals Monitoring window.



    3. Click Next .

      The values of the commands are assigned to the Rail_Command and Filler_Command ports.

    4. Click the Play of the compass to end the simulation.

Read Joint in Dataflow

You can program a Read Joint activity in Dataflow.

  1. Open a device that has a previously-defined mechanism, motion controller and simulation logic. The Main block must be a Dataflow block (see a typical example below).



  2. Double-click the Main block.




    • The Block Editor appears as an immersive window at the center of the screen.
    • A toolbox containing all the Block Editor commands appears at the right side of the screen.

    Note: In our example, the resource logic is undefined, so the editor is empty.

  3. Click Read Joint in the Activities toolbox. Then, click the Block Editor window to position the activity.



    The Read Joint Properties dialog box appears.

  4. Click OK.




    • The activity is created as a block instance.
    • Value (type float 64) is the joint value of the mechanism.

  5. Scroll over the instance to see the Read Joint activity parameter.



  6. Create a new Read Joint activity to retrieve the second joint value.

    1. Click Read joint in the Activities toolbox. Then, click the Block Editor window to position the activity.

      The Read Joint Properties dialog box appears.

    2. Select Prismatic.2 in the list.
    3. Click OK.



  7. Press Ctrl and select Selected Objects > Map To New Port in the ports contextual menu.



  8. To get shorter port names,

    1. Double-click the new port.

      The Block Properties dialog box appears.

    2. Modify the name of the ports.



    3. Click OK.

  9. To test the behavior of the activities in simulation:

    1. Select the Main block thumbnail and click the Play of the compass.

      The block is compiled and the simulation is initialized. The Simulation toolbar and the Signals Monitoring window appear.

    2. Click Next .

      The values of the commands are assigned to the Rail_command and Filler_Command ports

      .

    3. Click the Play of the compass to end the simulation.