The documentation for the c++ b0RemoteApi simxReadProximitySensor method suggests that the function returns the following:
A vector containing messagePack objects. The returned pointer remains valid until another remote API function is called. For convenience, you can use the helper functions to read its values. The vector contains:
item1 (bool): Whether the function was successfully called on the server side
item2 (int): detection state (0 or 1)
item3 (float): The distance to the detected point
item4 (float): The detected point relative to the sensor frame
item5 (int): The detected object handle
item6 (float): The normal vector of the detected surface, relative to the sensor frame
When the following code is exicuted, a "vector out of range exception" is thrown.
Code: Select all
auto out = APIHandle->simxReadProximitySensor(SensorHandle[i], APIHandle->simxServiceCall()); bool item1 = APIHandle->readBool(out, 0); LOG(DEBUG) << "1: " << item1; int item2 = APIHandle->readInt(out, 1); LOG(DEBUG) << " 2: " << item2; float item3 = APIHandle->readFloat(out, 2); LOG(DEBUG) << " 3: " << item3;
It seems that
simxReadProximitySensor()is returning a vector of capacity 2(Only the first two items).
Has anyone come across this before, or could anyone tell me what I am doing wrong?
IS it do do with