EZPhysics communicating with Matlab


The design and development of humanoid control is in it self a research area. Control experts usually use Matlab to easily experiment several approaches and values to achieve the desired model of control.

To allow for a better visual feedback and prototyping, a Matlab s-function was developed to communicate with EZPhysics simulation. This is done through an UDP channel using the HawkNL library to access network features both in Matlab and EZphysics.

Matlab application will Listen to port specified in the function parameters and EZPhysics application will connected to an IP and Port specified in the World Node.

The information sent between the two applications is only 32 bytes client sending and 36 bytes receiving. We send from the client the joints rotational positions and the yaw,pitch and roll of the torso. And Matlab sends the instruction (CW, CCW, HOLD), the torque value (one byte resolution between 0 and MAX_TORQUE) and a third byte of information for future use:

To download this demo visit source forge (the source code available the isn’t updated yet):


3 Responses to “EZPhysics communicating with Matlab”

  1. Paul Says:

    Hello, Jorgegraca.
    Your project is very interesting.
    I’m also building and modelling robot. I downloaded source code, you provided and tried to launch Simulink model. It asked to build mex- function. I tried to build it, copied all files it required to include in same folder with model file. Finally it gives me:
    Creating library C:\Users\ENGEL\AppData\Local\Temp\mex_GykW20\templib.x and object C:\Users\ENGEL\AppData\Local\Temp\mex_GykW20\templib.exp
    sfunctionEZPhysicsComs.obj : error LNK2019: unresolved external symbol “public: __cdecl EZPhysicsControlerFrame::EZPhysicsControlerFrame(unsigned short)” (??0EZPhysicsControlerFrame@@QEAA@G@Z) referenced in function “void __cdecl mdlStart(struct SimStruct_tag *)” (?mdlStart@@YAXPEAUSimStruct_tag@@@Z)
    sfunctionEZPhysicsComs.obj : error LNK2019: unresolved external symbol “public: float * __cdecl EZPhysicsControlerFrame::EZReceiveData(void)” (?EZReceiveData@EZPhysicsControlerFrame@@QEAAPEAMXZ) referenced in function “void __cdecl mdlOutputs(struct SimStruct_tag *,int)” (?mdlOutputs@@YAXPEAUSimStruct_tag@@H@Z)
    sfunctionEZPhysicsComs.obj : error LNK2019: unresolved external symbol “public: void __cdecl EZPhysicsControlerFrame::EZSendData(char *,char *,char *)” (?EZSendData@EZPhysicsControlerFrame@@QEAAXPEAD00@Z) referenced in function “void __cdecl mdlOutputs(struct SimStruct_tag *,int)” (?mdlOutputs@@YAXPEAUSimStruct_tag@@H@Z)
    sfunctionEZPhysicsComs.obj : error LNK2019: unresolved external symbol “public: __cdecl EZPhysicsControlerFrame::~EZPhysicsControlerFrame(void)” (??1EZPhysicsControlerFrame@@QEAA@XZ) referenced in function “public: void * __cdecl EZPhysicsControlerFrame::`scalar deleting destructor'(unsigned int)” (??_GEZPhysicsControlerFrame@@QEAAPEAXI@Z)
    sfunctionEZPhysicsComs.mexw64 : fatal error LNK1120: 4 unresolved externals

    I’m not familiar with programming classes, can you post compiled x64 function, please?

    Best regards,

    P.S. my robot project:

  2. Paul Says:


    Can you tell me, please, in general words about EZPhysics?
    http://www.ezphysics.org/ site doesn’t work, so i can’t find info about it.

    Best regards.

  3. jorgegraca Says:

    Hi Paul,

    I have been reworking this area of the application. Within the week I expect to have a better tutorial on the process.

    Thanks for the interest (and patience 🙂 )

    Jorge Graça

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: