robotology / icub-tutorials

Tutorials on iCub code
19 stars 9 forks source link

Moving both arms #6

Closed tunaonur closed 8 years ago

tunaonur commented 8 years ago

Hello,

I am trying to move both arms using tutorial_arm.cpp. I did some changes to the file, but it doesn't work. What kind of changes should I make to move both arms?

Thank you very much!

pattacini commented 8 years ago

Hi @tunaonur

I believe it'd be easier for us if you could post your customized code using Gist.

tunaonur commented 8 years ago

Sure, thanks in advance @pattacini!

https://gist.github.com/tunaonur/c1d496e737447c6052351b52ff60ce03

massimoregoli commented 8 years ago

Hi @tunaonur ,

you are using the same local port to configure the Property object of both arms:

std::string localPorts="/test/client";
std::string localPorts2="/test/client"; // for the left arm

You should use different names, otherwise there will be conflicts when the ports are opened.

tunaonur commented 8 years ago

I changed it but still only right arm is moving. Do you have any further suggestions? Are there any specific local ports that I might use or can I just change the name of the 2nd local port to "/test/client2" .

massimoregoli commented 8 years ago

No you don't need any specific name, "/test/client2" is fine. I will give a deeper look at the code and I will let you know.

massimoregoli commented 8 years ago

According to the code, it seems that you never exit the while loop that moves the right arm (the exit condition is true and I don't see any break; statement). The left arm is managed later, that's why it doesn't move.

lornat75 commented 8 years ago

In addition, you may need to set position control mode; this was not required when we wrote the tutorial, but is not in the specifications:

IControlMode2 *mode;
robotDevice.view(mode);

int jnts=0;
pos->getAxes(&jnts);

for (int j=0;j<jnts;j++)
    mode->setControlMode(j,VOCAB_CM_POSITION);
tunaonur commented 8 years ago

I can move both of them now! Thanks a lot! @lornat75 @massimoregoli