resibots / libdynamixel

C++ interface to the dynamixel actuators
GNU General Public License v2.0
9 stars 15 forks source link

Utility for Dynamixel Pro actuators #22

Closed dogoepp closed 7 years ago

dogoepp commented 7 years ago

Fixes #20 (hopefully).

Any other idea than creating one program for each version of the protocol ?

costashatz commented 7 years ago

Any other idea than creating one program for each version of the protocol ?

If Protocol1 and Protocol2 have the same functionality (i.e. the same commands and only the template changes), then you can use preprocessor directives (#ifdef) to just change the template. You need to modify the wscript to compile 2 targets (with different defines --- it's easy), but the source file will be one.

#ifdef PROTOCOL2
using Protocol = protocols::Protocol2;
#else
using Protocol = protocols::Protocol1;
#endif
typedef Utility<Protocol>::id_t id_t;
....
jbmouret commented 7 years ago

Yes, we can create 2 binaries from a single file.

Jean-Baptiste Mouret - Inria researcher www: http://members.loria.fr/JBMouret ERC ResiBots: http://www.resibots.eu

On Tue, Nov 15, 2016 at 8:10 PM Konstantinos Chatzilygeroudis < notifications@github.com> wrote:

Any other idea than creating one program for each version of the protocol ?

If Protocol1 and Protocol2 have the same functionality (i.e. the same commands and only the template changes), then you can use preprocessor directives (#ifdef) to just change the template. You need to modify the wscript to compile 2 targets (with different defines --- it's easy), but the source file will be one.

ifdef PROTOCOL2using Protocol = protocols::Protocol2;

elseusing Protocol = protocols::Protocol1;

endiftypedef Utility::id_t id_t;

....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/resibots/libdynamixel/pull/22#issuecomment-260736126, or mute the thread https://github.com/notifications/unsubscribe-auth/AFu8v-XE_3gqqwtd9ne0sIr87V7xUllNks5q-gNngaJpZM4Kyn89 .

dogoepp commented 7 years ago

Thanks for the advice, done.

dogoepp commented 7 years ago

Anything else needing changes ?

OK to merge ?

costashatz commented 7 years ago

It's ok for me...

dogoepp commented 7 years ago

OK, will merge, but in another pull request. I messed a bit with the history of this branch.