hx_robot_info bad data size

Discussion in 'MuJoCo HAPTIX Bug Reports' started by bit-warrior, Dec 29, 2017.

  1. Hello,

    I have modified the provided MPL.xml and MPL_left.xml, to mold a model with both hands in it ( i have attached the file, although it loads fine in the model). My objective is to have both hands in the model and control them using matlab. However when i run the command hx_robot_info, or hx_read_sensors i get error from mjhx "bad data size".
    mjhx('info') runs fine and provides me with the following:
    mjhx('info'), and some others work too, but i cannot control the hand.

    Thanks, and happy new year!
     

    Attached Files:

  2. Found out my only problem is that the number of joints is limited to 32. Right now I am trying to remake the mex file with a limit of joints/motor/sensor/imu of 100 ( such as to allow for two hands). I get the LNK2019 Error, I don't think its reading the .lib file properly or if something is missing.

    C:\Users\Armand\source\repos\mj_mex_wrapper\mj_mex_wrapper\apicpp>nmake

    Microsoft (R) Program Maintenance Utility Version 14.12.25834.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl /O2 /MT /EHsc mjhx.cpp mjhaptix_user.lib
    Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    mjhx.cpp
    mjhx.cpp(51): warning C4477: 'sprintf' : format string '%d' requires an argument
    of type 'int', but variadic argument 2 has type '::size_t'
    mjhx.cpp(51): note: consider using '%zd' in the format string
    mjhx.cpp(65): warning C4477: 'sprintf' : format string '%d' requires an argument
    of type 'int', but variadic argument 6 has type 'const mwSize'
    mjhx.cpp(65): note: consider using '%zd' in the format string
    mjhx.cpp(65): warning C4477: 'sprintf' : format string '%d' requires an argument
    of type 'int', but variadic argument 7 has type 'const mwSize'
    mjhx.cpp(65): note: consider using '%zd' in the format string
    Microsoft (R) Incremental Linker Version 14.12.25834.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    /out:mjhx.exe
    mjhx.obj
    mjhaptix_user.lib
    mjhx.obj : error LNK2019: unresolved external symbol mxGetNumberOfDimensions_730
    referenced in function "void __cdecl checkNumeric(struct mxArray_tag const *,ch
    ar const *,int,int)" (?checkNumeric@@YAXPEBUmxArray_tag@@PEBDHH@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetDimensions_730 referen
    ced in function "void __cdecl checkNumeric(struct mxArray_tag const *,char const
    *,int,int)" (?checkNumeric@@YAXPEBUmxArray_tag@@PEBDHH@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetClassID referenced in
    function "void __cdecl checkNumeric(struct mxArray_tag const *,char const *,int,
    int)" (?checkNumeric@@YAXPEBUmxArray_tag@@PEBDHH@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetPr referenced in funct
    ion "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* const)[2],int
    ,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetScalar referenced in f
    unction mexFunction
    mjhx.obj : error LNK2019: unresolved external symbol mxGetFieldNumber referenced
    in function "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* cons
    t)[2],int,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@
    Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetField_730 referenced i
    n function "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* const)
    [2],int,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@Z)

    mjhx.obj : error LNK2019: unresolved external symbol mxSetField_730 referenced i
    n function "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* const)
    [2],int,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@Z)

    mjhx.obj : error LNK2019: unresolved external symbol mxCreateDoubleMatrix_730 re
    ferenced in function "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const
    (* const)[2],int,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$C
    BHHPEBD@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mxCreateDoubleScalar refere
    nced in function "struct mxArray_tag * __cdecl hxreadsensors(void)" (?hxreadsens
    ors@@YAPEAUmxArray_tag@@XZ)
    mjhx.obj : error LNK2019: unresolved external symbol mxGetString_730 referenced
    in function mexFunction
    mjhx.obj : error LNK2019: unresolved external symbol mxCreateString referenced i
    n function mexFunction
    mjhx.obj : error LNK2019: unresolved external symbol mxCreateStructMatrix_730 re
    ferenced in function "struct mxArray_tag * __cdecl getactuator(void)" (?getactua
    tor@@YAPEAUmxArray_tag@@XZ)
    mjhx.obj : error LNK2019: unresolved external symbol mexErrMsgTxt referenced in
    function "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* const)[2
    ],int,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mexPrintf referenced in fun
    ction "void __cdecl mjc2mx2<int,2>(struct mxArray_tag *,int const (* const)[2],i
    nt,char const *)" (??$mjc2mx2@H$01@@YAXPEAUmxArray_tag@@QEAY01$$CBHHPEBD@Z)
    mjhx.obj : error LNK2019: unresolved external symbol mexLock referenced in funct
    ion mexFunction
    mjhx.obj : error LNK2019: unresolved external symbol mexUnlock referenced in fun
    ction "void __cdecl exitFunction(void)" (?exitFunction@@YAXXZ)
    mjhx.obj : error LNK2019: unresolved external symbol mexAtExit referenced in fun
    ction mexFunction
    mjhx.exe : fatal error LNK1120: 18 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017
    \Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.EXE"' : return code '0x2
    '
    Stop.

    C:\Users\Armand\source\repos\mj_mex_wrapper\mj_mex_wrapper\apicpp>



    The search for truth and knowledge continues...
     
  3. I created a new mex file by running on matlab commandline "mex mjhx.cpp mjhaptix_user.lib" and it completes successfully ( in haptix.h I changed the defined max number of joints and motors). However I still get the error of "bad data size" when I run "hx_robot_info".
     
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    The maximum sizes are already compiled in mjhaptix_user.dll. There is nothing you can do on your end to change them. All you can do is change the header file, but that does not recompile the DLL. The hx_XXX interface was meant to be a standard, designed jointly with DARPA and OSRF, and these limits are part of it. I was not too fond of the way the standard turned out, which is why I also provided the native API. It has built-in limits but they are set to 1000, so it should not be a problem.