Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select a real world codebase for a first proof of concept #26

Closed
traversaro opened this issue Jan 5, 2021 · 7 comments
Closed

Select a real world codebase for a first proof of concept #26

traversaro opened this issue Jan 5, 2021 · 7 comments
Assignees

Comments

@traversaro
Copy link
Member

No description provided.

@traversaro
Copy link
Member Author

We could look into something used in real world, even if simple. We can take something from https:/robotology/icub-basic-demos or from the vvv tutorial. Ideally we should not do a example from no where, as we risk of structuring the code around our available APIs, rather then understanding how our APIs should be done to be convenient to use on real world code.

@traversaro
Copy link
Member Author

A relatively simple example for sure used in real world is https:/robotology/icub-tests/blob/v1.18.0/src/positionDirect/PositionDirect.cpp#L243, but perhaps the RTF machine may be complicate its use. A more didactic example is https:/vvv-school/tutorial_joint-interface/blob/4d71c7846b61ad321b0f53f8c5a09b6880a25d1c/src/positiondirect.cpp#L171.

@traversaro
Copy link
Member Author

Another interesting possible use is robotology/gazebo-yarp-plugins#529 , in which a simple test for the gazebo_yarp_controlboard is added, and in which the telemetry could be used to gather data on measured vs desired position and velocity, in place of simple prints https:/robotology/gazebo-yarp-plugins/pull/529/files#diff-5a4a105a9b072d936198482927cfd93bd43bee3159bd74640f4c1d2acf77ef48R115 .

@Nicogene
Copy link
Member

Today I tried including the yarp::telemetry::BufferManager inside https:/vvv-school/tutorial_joint-interface, in particular in tutorial_joint-interface-position.

Here are the modifications:

--- a/src/position.cpp
+++ b/src/position.cpp
@@ -12,6 +12,7 @@
 #include <yarp/os/RFModule.h>
 #include <yarp/os/RpcServer.h>
 #include <yarp/os/Time.h>
+#include <yarp/telemetry/BufferManager.h>

 #include <yarp/dev/Drivers.h>
 #include <yarp/dev/PolyDriver.h>
@@ -20,6 +21,8 @@
 using namespace yarp::os;
 using namespace yarp::dev;

+yarp::telemetry::BufferManager<double> bm("tutorial_pos_ctrl.mat",
+                                          { {"pos",{1,1}} }, 100, true);

 class CtrlModule: public RFModule
 {
@@ -69,6 +72,8 @@ protected:
         double t0=Time::now();
         while (!done&&(Time::now()-t0<10.0))
         {
+            ienc->getEncoder(joint,&enc);
+            bm.push_back({enc}, "pos");
             yInfo()<<"Waiting...";
             Time::delay(0.1);   // release the quantum to avoid starving resources
             ipos->checkMotionDone(&done);

Result

Here is the resulting struct:

>> tutorial_pos_ctrl.pos

ans = 

  struct with fields:

          data: [1×1×67 double]
    dimensions: [67 1 1]
          name: 'pos'
    timestamps: [1×67 double]

Issues

@traversaro
Copy link
Member Author

Moreover, I had issues with not having enough samples dumped(100 in this example), see

Tracked in #46 .

@traversaro
Copy link
Member Author

@Nicogene can you paste the link to the fork/branch of the modified version of the example, and the we can close the issue?

@Nicogene
Copy link
Member

Here is the branch where I pushed these changes https:/Nicogene/tutorial_joint-interface/tree/yarp_telemetry

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants