The kernel drivers for HY-SRF05, MPU-9250 and all servos are misc devices. The misc devices for the two servos create a file where the sensor data can be read. Therefore a structure is defined for each sensor so the data can be easily in the userspace. The servo driver creates two misc devices where both files can be written. One file is used to set all servos to a fixed position. The second file is used to calibrate the servos. For each file exists a structure that has to be used to write the files.
#!/usr/bin/Python
with open("/dev/hy-srf05", "rb") as f
data = f.read(self._HYS_DATA_SIZE)
message = Protocol.Command().createFromTLV(Protocol.Tag.GetHeight,data).getTransmission()
self.com.write(message)
#!/usr/bin/Python
with open("/dev/mpu9250_poll", "rb") as f:
data = f.read(self._MPU_DATA_SIZE)
message = Protocol.Command().createFromTLV(Protocol.Tag.GetCoord,data).getTransmission()
self.com.write(message)