<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def check_sim_in(self):
        '''check for FDM packets from runsim'''
        try:
            pkt = self.sim_in.recv(17*8 + 4)
        except socket.error as e:
            if not e.errno in [ errno.EAGAIN, errno.EWOULDBLOCK ]:
                raise
            return
        if len(pkt) != 17*8 + 4:
            # wrong size, discard it
            print("wrong size %u" % len(pkt))
            return
        (latitude, longitude, altitude, heading, v_north, v_east, v_down,
         ax, ay, az,
         phidot, thetadot, psidot,
         roll, pitch, yaw,
         vcas, check) = struct.unpack('<17dI', pkt)
        (p, q, r) = self.convert_body_frame(radians(roll), radians(pitch), radians(phidot), radians(thetadot), radians(psidot))

        try:
            self.hil_state_msg = self.master.mav.hil_state_encode(int(time.time()*1e6),
                                                                        radians(roll),
                                                                        radians(pitch),
                                                                        radians(yaw),
                                                                        p,
                                                                        q,
                                                                        r,
                                                                        int(latitude*1.0e7),
                                                                        int(longitude*1.0e7),
                                                                        int(altitude*1.0e3),
                                                                        int(v_north*100),
                                                                        int(v_east*100),
                                                                        0,
                                                                        int(ax*1000/9.81),
                                                                        int(ay*1000/9.81),
                                                                        int(az*1000/9.81))
        except Exception:
            return