|
| 1 | +:github_url: https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/doc/examples/primary_pipeline_calibration.rst |
| 2 | + |
| 3 | +.. _primary_pipeline_calibration_example: |
| 4 | + |
| 5 | +Primary Pipeline Calibration example |
| 6 | +==================================== |
| 7 | + |
| 8 | +This example is very similar to the :ref:`primary_pipeline_example`. However, it uses a |
| 9 | +specialized consumer that will analyze the calibration data sent from the robot instead of the |
| 10 | +``ShellConsumer``. |
| 11 | + |
| 12 | +Consumer setup |
| 13 | +-------------- |
| 14 | + |
| 15 | +This example uses a specialized type of consumer that stores data about the received robot |
| 16 | +calibration. |
| 17 | + |
| 18 | +.. literalinclude:: ../../examples/primary_pipeline_calibration.cpp |
| 19 | + :language: c++ |
| 20 | + :caption: examples/primary_pipeline_calibration.cpp |
| 21 | + :linenos: |
| 22 | + :lineno-match: |
| 23 | + :start-at: class CalibrationConsumer |
| 24 | + :end-at: }; |
| 25 | + |
| 26 | +Since the producer is reading every package from the primary interface, the consumer has to be able |
| 27 | +to consume any primary package. |
| 28 | + |
| 29 | +Assemble the pipeline |
| 30 | +--------------------- |
| 31 | + |
| 32 | +The rest of the pipeline setup is the same as in the other pipeline example, just that we create a |
| 33 | +``CalibrationConsumer`` instead of a ``ShellConsumer``: |
| 34 | + |
| 35 | +.. literalinclude:: ../../examples/primary_pipeline_calibration.cpp |
| 36 | + :language: c++ |
| 37 | + :caption: examples/primary_pipeline_calibration.cpp |
| 38 | + :linenos: |
| 39 | + :lineno-match: |
| 40 | + :start-at: // The calibration consumer |
| 41 | + :end-at: calib_pipeline.run() |
| 42 | + |
| 43 | +Again, product handling will be happening in the background, so in the rest of the program we wait |
| 44 | +until the calibration consumer received and processed data and then print information about that: |
| 45 | + |
| 46 | +.. literalinclude:: ../../examples/primary_pipeline_calibration.cpp |
| 47 | + :language: c++ |
| 48 | + :caption: examples/primary_pipeline_calibration.cpp |
| 49 | + :linenos: |
| 50 | + :lineno-match: |
| 51 | + :start-at: while (!calib_consumer |
| 52 | + :end-at: return 0 |
0 commit comments