touch sensor number

Discussion in 'HAPTIX' started by David Kluger, Mar 24, 2015.

  1. I added 2 contact sensors to the API (from the original 19 on the virtual limb) in an attempt to allow the API to return contact forces on 21 contact sensors. Apparently, there is a 20-contact-limit for the API, because attempting to return contact data from an hx_read_sensors() call returned a MATLAB error: "Error using mjhx; Bad data size." This problem did not occur when I removed one of the touch sensors from the .xml file resulting in a total of 20 contact sensors in the simulation.

    I expected the API to be able to return contact data for however many touch sensors you declare in the .xml simulation file. However, there is a hard upper limit of 20. For our experiments, we may need API-control of over 20 contact sensors. Can MuJoCo's API capability be extended to accommodate more than 20 contact sensors?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    There is a hard limit but it is 32... I suspect you are getting the error for a different reason. The user-side library compares the size of the data arrays returned from the simulator to the last hxRobotInfo it got from a call to hx_robot_info, or from hx_update (which calls hx_robot_info internally). If you connect, and then load a model with different number of elements of any kind, you should call hx_robot_info from the user side before calling the other API functions.

    The reason for this design is that the user must be aware at all times what model is being simulated, or else bad things are bound to happen. We could of course transmit the constant model info (including sizes) at every update, but that seemed wasteful, thus the present design.