def simxGetObjectFloatParameter(clientID, objectHandle, parameterID, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
parameterValue = ct.c_float()
return c_GetObjectFloatParameter(clientID, objectHandle, parameterID, ct.byref(parameterValue), operationMode), parameterValue.value
python类c_float()的实例源码
def simxGetObjectVelocity(clientID, objectHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
linearVel = (ct.c_float*3)()
angularVel = (ct.c_float*3)()
ret = c_GetObjectVelocity(clientID, objectHandle, linearVel, angularVel, operationMode)
arr1 = []
for i in range(3):
arr1.append(linearVel[i])
arr2 = []
for i in range(3):
arr2.append(angularVel[i])
return ret, arr1, arr2
def uniform_matrixf(self, name, mat):
# obtian the uniform location
loc = glGetUniformLocation(self.handle, name)
# uplaod the 4x4 floating point matrix
glUniformMatrix4fv(loc, 1, False, (c_float * 16)(*mat))
def simxGetJointPosition(clientID, jointHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
position = ct.c_float()
return c_GetJointPosition(clientID, jointHandle, ct.byref(position), operationMode), position.value
def simxGetJointMatrix(clientID, jointHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
matrix = (ct.c_float*12)()
ret = c_GetJointMatrix(clientID, jointHandle, matrix, operationMode)
arr = []
for i in range(12):
arr.append(matrix[i])
return ret, arr
def simxSetSphericalJointMatrix(clientID, jointHandle, matrix, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
matrix = (ct.c_float*12)(*matrix)
return c_SetSphericalJointMatrix(clientID, jointHandle, matrix, operationMode)
def simxJointGetForce(clientID, jointHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
force = ct.c_float()
return c_GetJointForce(clientID, jointHandle, ct.byref(force), operationMode), force.value
def simxGetJointForce(clientID, jointHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
force = ct.c_float()
return c_GetJointForce(clientID, jointHandle, ct.byref(force), operationMode), force.value
def simxGetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
eulerAngles = (ct.c_float*3)()
ret = c_GetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, eulerAngles, operationMode)
arr = []
for i in range(3):
arr.append(eulerAngles[i])
return ret, arr
def simxSetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, eulerAngles, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
angles = (ct.c_float*3)(*eulerAngles)
return c_SetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, angles, operationMode)
def simxSetObjectPosition(clientID, objectHandle, relativeToObjectHandle, position, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
c_position = (ct.c_float*3)(*position)
return c_SetObjectPosition(clientID, objectHandle, relativeToObjectHandle, c_position, operationMode)
def simxGetArrayParameter(clientID, paramIdentifier, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
paramValues = (ct.c_float*3)()
ret = c_GetArrayParameter(clientID, paramIdentifier, paramValues, operationMode)
arr = []
for i in range(3):
arr.append(paramValues[i])
return ret, arr
def simxSetArrayParameter(clientID, paramIdentifier, paramValues, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
c_paramValues = (ct.c_float*3)(*paramValues)
return c_SetArrayParameter(clientID, paramIdentifier, c_paramValues, operationMode)
def simxGetFloatingParameter(clientID, paramIdentifier, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
paramValue = ct.c_float()
return c_GetFloatingParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode), paramValue.value
def simxGetObjectFloatParameter(clientID, objectHandle, parameterID, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
parameterValue = ct.c_float()
return c_GetObjectFloatParameter(clientID, objectHandle, parameterID, ct.byref(parameterValue), operationMode), parameterValue.value
def get_speed(self):
return self.device.get_property(c_api.ONI_DEVICE_PROPERTY_PLAYBACK_SPEED, ctypes.c_float)
def get_horizontal_fov(self):
return self.get_property(c_api.ONI_STREAM_PROPERTY_HORIZONTAL_FOV, ctypes.c_float).value
def get_vertical_fov(self):
return self.get_property(c_api.ONI_STREAM_PROPERTY_VERTICAL_FOV, ctypes.c_float).value
def convert_world_to_depth(depthStream, worldX, worldY, worldZ):
"""const VideoStream& depthStream, float worldX, float worldY, float worldZ"""
out_depthX = ctypes.c_float()
out_depthY = ctypes.c_float()
out_depthZ = ctypes.c_float()
c_api.oniCoordinateConverterWorldToDepth(depthStream._handle, worldX, worldY, worldZ,
ctypes.byref(out_depthX), ctypes.byref(out_depthY), ctypes.byref(out_depthZ))
return out_depthX.value, out_depthY.value, out_depthZ.value
def convert_depth_to_world(depthStream, depthX, depthY, depthZ):
"""const VideoStream& depthStream, float depthX, float depthY, float depthZ, float* pWorldX, float* pWorldY, float* pWorldZ"""
out_depthX = ctypes.c_float()
out_depthY = ctypes.c_float()
out_depthZ = ctypes.c_float()
c_api.oniCoordinateConverterDepthToWorld(depthStream._handle, depthX, depthY, depthZ,
ctypes.byref(out_depthX), ctypes.byref(out_depthY), ctypes.byref(out_depthZ))
return out_depthX.value, out_depthY.value, out_depthZ.value