def test_sunsensor(self, value):
        qBI = np.asarray(value[0])
        v_sv_i = np.asarray(value[1])

        v_pos_i = np.array([1e6, -2.03, -3.0])
        v_vel_i = np.array([2.0e3, 2.8, -73.2])
        qBO = frames.qBI2qBO(qBI, v_pos_i, v_vel_i)
        state = np.hstack((qBO, np.zeros(3)))
        mySat = satellite.Satellite(state, 12.0)
        mySat.setQ_BI(qBI)
        result = defblock.sunsensor(mySat, v_sv_i)
        v_expected = value[2], value[3]
        self.assertTrue(np.allclose(result, v_expected))
	def test_sunsensor(self,value): 
		qBI = np.asarray(value[0])
		v_sv_i=np.asarray(value[1])

		v_pos_i = np.array([1e6,-2.03,-3.0])
		v_vel_i = np.array([2.0e3,2.8,-73.2])
		qBO = frames.qBI2qBO(qBI,v_pos_i,v_vel_i)
		state = np.hstack((qBO,np.zeros(3)))
		mySat = satellite.Satellite(state,12.0)
		mySat.setSun_i(v_sv_i)
		mySat.setPos(v_pos_i)
		mySat.setVel(v_vel_i)
		qOI = qnv.quatMultiplyNorm(qnv.quatInv(qBO),qBI)
		result = defblock.sunsensor(mySat)
		v_expected = value[2];

		self.assertTrue(np.allclose(result,v_expected))
示例#3
0
    for i in range(0, Ncontrol):  # loop for control-cycle

        if math.fmod(
                i, int(Ncontrol / 100)
        ) == 0:  # we are printing percentage of cycle completed to keep track of simulation
            print(int(100 * i / Ncontrol))

        if (i % (i_time_gps + i_time_J2) <= i_time_gps):
            propbool = 0
        else:
            propbool = 1

        # sensor reading
        if (sensbool == 0):
            # getting default sensor reading (zero noise in our case)
            Advitiy.setSun_b_m(defblock.sunsensor(Advitiy))
            Advitiy.setMag_b_m_p(Advitiy.getMag_b_m_c())
            Advitiy.setMag_b_m_c(defblock.magnetometer(Advitiy))
            Advitiy.setgpsData(defblock.gps(Advitiy))
            Advitiy.setOmega_m(defblock.gyroscope(Advitiy))
        #        Advitiy.setJ2Data(defblock.J2_propagator(Advitiy))

        if (sensbool == 1):
            # getting sensor reading from models
            Advitiy.setSun_b_m(sensor.sunsensor(Advitiy))
            Advitiy.setMag_b_m_p(Advitiy.getMag_b_m_c())
            Advitiy.setMag_b_m_c(sensor.magnetometer(Advitiy))
            Advitiy.setOmega_m(sensor.gyroscope(Advitiy))
        if (propbool == 0):
            # Using sgp to propagate
            Advitiy.setgpsData(sensor.GPS(Advitiy))