Page 1 of 1

Cross Compilation to real e-puck

Posted: 02 Sep 2013, 11:36
by fairread
Hi is it possible to cross-compile my V-Rep codes and upload them on my real e-puck robots? If so, could anyone please suggest any reference eg tutorials/examples related to cross compilation with V-Rep? Thanks.

Re: Cross Compilation to real e-puck

Posted: 02 Sep 2013, 14:15
by coppelia
Hello,

you could do this if you are using the remote API functionality to write your controller. You will have to differentiate whether you are compiling locally (i.e. with the remote API) or for the real robot. You would do this with preprocessor commands.
Finally you could cross compile the C/C++ code for your robot. This will depend what compiler/code your robot expects and varies greatly.

Cheers

Re: Cross Compilation to real e-puck

Posted: 02 Sep 2013, 14:54
by fairread
Hi Coppelia Admin,

Thanks for your reply. Even though at the moment cross compilation with V-Rep still looks vague to me (wishing for a beginner tutorial or a simple example) but getting to know that such thing is possible really made my day! Thanks man! :)

Re: Cross Compilation to real e-puck

Posted: 02 Sep 2013, 15:11
by coppelia
V-REP will actually not compile the C/C++ application for you (i.e. there is no embedded c/c++ compiler in V-REP).
But: the E-Puck comes with a cross compilation toolchain, I am sure. Or: how are you compiling programs for the E-puck?

Cheers

Re: Cross Compilation to real e-puck

Posted: 06 Sep 2013, 11:59
by fairread
At the moment, I've yet to program any epuck directly, as they're unavailable yet to me. My task is now to run the epuck simulation (using V-Rep) with some AI algorithms.

FYI, I'm using Windows, but I could also make a do with Ubuntu environment if there might be any issue related to Windows OS in setting up the programming tool between my PC and e-puck robots.

About the cross compilation (for future planning), my idea is to use the Microchip MPLAB X and its bootloader to compile the C codes of e-puck (which contains V-Rep remote API) and load it to the e-puck processor. This idea is based on the following references:

http://sjriek.nl/projects/e-puck/programming/
http://robots-iscte.wikispaces.com/e-puck
http://www.yumantech.org/wiki/Technical ... ompilation

Hope to hear your comments about my planning here in implementing my C codes with V-Rep remote API to the real e-puck robots. Thanks again.

Re: Cross Compilation to real e-puck

Posted: 09 Sep 2013, 13:04
by fairread
Anyway about my project, I wish to program my epucks to operate autonomously without connection to any server PC. Those epucks are equipped with ARM processor embedded on the extension boards and barebone linux can now be run on it. Thus how can I actually use V-Rep for this purpose? The common way is to have Player server install into the epucks but I'm looking into the possibility of using V-Rep rather than Player server. Thanks.

Re: Cross Compilation to real e-puck

Posted: 10 Sep 2013, 15:00
by coppelia
If I understood you correctly:
  • you want to run your Epuck in an autonomous fashion (no communication with any server)
  • but you also want to test your Epuck algorithm in a virtual environment, such as V-REP
  • you want to use the same program (c code) for above 2 first items
is that right?

If so, just program you Epuck as you would normally do. Then add #ifdef VIRTUAL_TESTBED sections, in which you will have to add alternate code. Typically, instead of sending motor speed values to the real motor, you will send them to V-REP. For example:

Code: Select all

void initializeEpuck()
{
#ifdef VIRTUAL_TESBED
    clientID=simxStart("127.0.0.1",portNb,true,true,2000,5);
#else
    // initialize Epuck hardware, etc.
#endif
}

void setMotorVelocities(float l,float r)
{
#ifdef VIRTUAL_TESBED
    simxSetJointTargetVelocity(clientID,leftMotorHandle,l,simx_opmode_oneshot);
    simxSetJointTargetVelocity(clientID,rightMotorHandle,r,simx_opmode_oneshot);
#else
    setLeftMotorVelocity(l); // tell the real motors what speed to adopt
    setRightMotorVelocity(r);
#endif
}

void deinitializeEpuck()
{
#ifdef VIRTUAL_TESBED
    if (clientID!=-1)
        simxFinish(clientID);
#else
    // deinitialize Epuck hardware, etc.
#endif
}
Just a simple example.

Cheers