コード例 #1
0
ファイル: test_orbit.py プロジェクト: rosalesr/krpc
    def test_vessel_orbiting_minmus_on_parabolic_arc(self):
        testingtools.set_orbit("Minmus", 80000, 3, 0, 0, 0, 0, 0)
        vessel = self.conn.space_center.active_vessel
        orbit = vessel.orbit
        self.assertEqual("Minmus", orbit.body.name)
        self.assertClose(-320000, orbit.apoapsis, error=50)
        self.assertClose(160000, orbit.periapsis, error=50)
        self.assertClose(-320000 - 60000, orbit.apoapsis_altitude, error=50)
        self.assertClose(160000 - 60000, orbit.periapsis_altitude, error=50)
        sma = 0.5 * (-320000 + 160000)
        e = 3
        self.assertClose(sma, orbit.semi_major_axis, error=50)
        self.assertTrue(math.isnan(orbit.semi_minor_axis))
        # self.check_radius_and_speed(vessel, orbit)
        # self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
        # self.assertClose(12884, orbit.time_to_soi_change, error=5)
        self.assertClose(e, orbit.eccentricity, error=0.1)
        self.assertClose(0, orbit.inclination, error=0.1)
        # self.assertClose(0, orbit.longitude_of_ascending_node, error=0.1)
        # self.assertClose(0, orbit.argument_of_periapsis, error=0.1)
        # self.assertClose(0, orbit.mean_anomaly_at_epoch, error=0.1)
        # self.assertClose(0, orbit.epoch, error=0.1)
        # self.check_anomalies(vessel, orbit)
        self.assertTrue(orbit.next_orbit is not None)

        orbit = orbit.next_orbit
        self.assertEqual("Kerbin", orbit.body.name)
コード例 #2
0
ファイル: test_orbit.py プロジェクト: pipi1226/krpc
    def test_vessel_orbiting_minmus_on_parabolic_arc(self):
        testingtools.set_orbit('Minmus', 80000, 3, 0, 0, 0, 0, 0)
        vessel = self.conn.space_center.active_vessel
        orbit = vessel.orbit
        self.assertEqual('Minmus', orbit.body.name)
        self.assertClose(-320000, orbit.apoapsis, error=50)
        self.assertClose(160000, orbit.periapsis, error=50)
        self.assertClose(-320000 - 60000, orbit.apoapsis_altitude, error=50)
        self.assertClose(160000 - 60000, orbit.periapsis_altitude, error=50)
        sma = (0.5 * (-320000 + 160000))
        e = 3
        self.assertClose(sma, orbit.semi_major_axis, error=50)
        self.assertTrue(math.isnan(orbit.semi_minor_axis))
        #self.check_radius_and_speed(vessel, orbit)
        #self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
        #self.assertClose(12884, orbit.time_to_soi_change, error=5)
        self.assertClose(e, orbit.eccentricity, error=0.1)
        self.assertClose(0, orbit.inclination, error=0.1)
        #self.assertClose(0, orbit.longitude_of_ascending_node, error=0.1)
        #self.assertClose(0, orbit.argument_of_periapsis, error=0.1)
        #self.assertClose(0, orbit.mean_anomaly_at_epoch, error=0.1)
        #self.assertClose(0, orbit.epoch, error=0.1)
        #self.check_anomalies(vessel, orbit)
        self.assertTrue(orbit.next_orbit is not None)

        orbit = orbit.next_orbit
        self.assertEqual('Kerbin', orbit.body.name)
コード例 #3
0
ファイル: test_orbit.py プロジェクト: rosalesr/krpc
    def test_vessel_orbiting_mun_on_escape_soi(self):
        testingtools.set_orbit("Mun", 1800000, 0.52, 0, 13, 67, 6.25, 0)
        vessel = self.conn.space_center.active_vessel
        orbit = vessel.orbit
        self.assertEqual("Mun", orbit.body.name)
        self.assertClose(2736000, orbit.apoapsis, error=100)
        self.assertClose(864000, orbit.periapsis, error=50)
        self.assertClose(2736000 - 200000, orbit.apoapsis_altitude, error=100)
        self.assertClose(864000 - 200000, orbit.periapsis_altitude, error=50)
        sma = 0.5 * (2736000 + 864000)
        e = 0.52
        self.assertClose(sma, orbit.semi_major_axis, error=50)
        self.assertClose(sma * math.sqrt(1 - (e * e)), orbit.semi_minor_axis, error=50)
        # self.check_radius_and_speed(vessel, orbit)
        self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
        # self.assertClose(17414, orbit.time_to_soi_change,error=5)
        self.assertClose(e, orbit.eccentricity, error=0.1)
        self.assertClose(0, orbit.inclination, error=0.1)
        # self.assertClose(13 * (math.pi/180), orbit.longitude_of_ascending_node, error=0.1)
        # self.assertClose(67 * (math.pi/180), orbit.argument_of_periapsis, error=0.1)
        # self.assertClose(6.25, orbit.mean_anomaly_at_epoch, error=0.1)
        # self.assertClose(0, orbit.epoch, error=0.1)
        self.check_anomalies(vessel, orbit)
        self.assertTrue(orbit.next_orbit is not None)

        orbit = orbit.next_orbit
        self.assertEqual("Kerbin", orbit.body.name)
コード例 #4
0
ファイル: test_orbit.py プロジェクト: pipi1226/krpc
    def test_vessel_orbiting_mun_on_escape_soi(self):
        testingtools.set_orbit('Mun', 1800000, 0.52, 0, 13, 67, 6.25, 0)
        vessel = self.conn.space_center.active_vessel
        orbit = vessel.orbit
        self.assertEqual('Mun', orbit.body.name)
        self.assertClose(2736000, orbit.apoapsis, error=100)
        self.assertClose(864000, orbit.periapsis, error=50)
        self.assertClose(2736000 - 200000, orbit.apoapsis_altitude, error=100)
        self.assertClose(864000 - 200000, orbit.periapsis_altitude, error=50)
        sma = (0.5 * (2736000 + 864000))
        e = 0.52
        self.assertClose(sma, orbit.semi_major_axis, error=50)
        self.assertClose(sma * math.sqrt(1 - (e * e)),
                         orbit.semi_minor_axis,
                         error=50)
        #self.check_radius_and_speed(vessel, orbit)
        self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
        #self.assertClose(17414, orbit.time_to_soi_change,error=5)
        self.assertClose(e, orbit.eccentricity, error=0.1)
        self.assertClose(0, orbit.inclination, error=0.1)
        #self.assertClose(13 * (math.pi/180), orbit.longitude_of_ascending_node, error=0.1)
        #self.assertClose(67 * (math.pi/180), orbit.argument_of_periapsis, error=0.1)
        #self.assertClose(6.25, orbit.mean_anomaly_at_epoch, error=0.1)
        #self.assertClose(0, orbit.epoch, error=0.1)
        self.check_anomalies(vessel, orbit)
        self.assertTrue(orbit.next_orbit is not None)

        orbit = orbit.next_orbit
        self.assertEqual('Kerbin', orbit.body.name)
コード例 #5
0
ファイル: test_orbit.py プロジェクト: pipi1226/krpc
 def test_vessel_orbiting_bop(self):
     testingtools.set_orbit('Bop', 320000, 0.18, 27, 38, 241, 2.3, 0)
     vessel = self.conn.space_center.active_vessel
     orbit = vessel.orbit
     self.assertEqual('Bop', orbit.body.name)
     self.assertClose(377600, orbit.apoapsis, error=50)
     self.assertClose(262400, orbit.periapsis, error=50)
     self.assertClose(377600 - 65000, orbit.apoapsis_altitude, error=50)
     self.assertClose(262400 - 65000, orbit.periapsis_altitude, error=50)
     sma = 0.5 * (377600 + 262400)
     e = 0.18
     self.assertClose(sma, orbit.semi_major_axis, error=50)
     self.assertClose(sma * math.sqrt(1 - (e * e)),
                      orbit.semi_minor_axis,
                      error=50)
     #self.check_radius_and_speed(vessel, orbit)
     self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
     #self.assertTrue(math.isnan(orbit.time_to_soi_change))
     self.assertClose(e, orbit.eccentricity, error=0.1)
     self.assertClose(27 * (math.pi / 180), orbit.inclination, error=0.1)
     #self.assertClose(38 * (math.pi/180), orbit.longitude_of_ascending_node, error=0.1)
     #self.assertClose(241 * (math.pi/180), orbit.argument_of_periapsis, error=0.1)
     #self.assertClose(2.3, orbit.mean_anomaly_at_epoch, error=0.2)
     #self.assertClose(0, orbit.epoch, error=0.1)
     self.check_anomalies(vessel, orbit)
コード例 #6
0
ファイル: test_autopilot.py プロジェクト: Kerbal007/krpc
 def setUpClass(cls):
     testingtools.new_save()
     testingtools.remove_other_vessels()
     testingtools.launch_vessel_from_vab('Multi')
     testingtools.set_orbit('Eve', 1070000, 0.15, 16.2, 70.5, 180.8, 1.83, 251.1)
     cls.conn = testingtools.connect(name='TestAutoPilotOtherVessel')
     next(iter(cls.conn.space_center.active_vessel.parts.docking_ports)).undock()
     cls.vessel = cls.conn.space_center.active_vessel
     cls.other_vessel = next(iter(filter(lambda v: v != cls.vessel, cls.conn.space_center.vessels)))
コード例 #7
0
ファイル: test_autopilot.py プロジェクト: stpinker/krpc
 def setUpClass(cls):
     testingtools.new_save()
     testingtools.launch_vessel_from_vab('Basic')
     testingtools.remove_other_vessels()
     testingtools.set_orbit('Eve', 1070000, 0.15, 16.2, 70.5, 180.8, 1.83, 251.1)
     time.sleep(5) #FIXME: remove sleep
     cls.conn = krpc.connect()
     cls.vessel = cls.conn.space_center.active_vessel
     cls.ap = cls.vessel.auto_pilot
     cls.sas_mode = cls.conn.space_center.SASMode
     cls.speed_mode = cls.conn.space_center.SpeedMode
コード例 #8
0
ファイル: test_autopilot.py プロジェクト: Kerbal007/krpc
 def setUpClass(cls):
     testingtools.new_save()
     testingtools.remove_other_vessels()
     testingtools.launch_vessel_from_vab('Basic')
     testingtools.set_orbit('Eve', 1070000, 0.15, 16.2, 70.5, 180.8, 1.83, 251.1)
     cls.conn = testingtools.connect()
     cls.vessel = cls.conn.space_center.active_vessel
     cls.ap = cls.vessel.auto_pilot
     cls.sas_mode = cls.conn.space_center.SASMode
     cls.speed_mode = cls.conn.space_center.SpeedMode
     cls.ap.rotation_speed_multiplier = 2
     cls.ap.roll_speed_multiplier = 2
     cls.ap.set_pid_parameters(3,0,0)
コード例 #9
0
ファイル: test_autopilot.py プロジェクト: pipi1226/krpc
 def setUpClass(cls):
     testingtools.new_save()
     testingtools.remove_other_vessels()
     testingtools.launch_vessel_from_vab('Multi')
     testingtools.set_orbit('Eve', 1070000, 0.15, 16.2, 70.5, 180.8, 1.83,
                            251.1)
     cls.conn = testingtools.connect(name='TestAutoPilotOtherVessel')
     next(iter(
         cls.conn.space_center.active_vessel.parts.docking_ports)).undock()
     cls.vessel = cls.conn.space_center.active_vessel
     cls.other_vessel = next(
         iter(
             filter(lambda v: v != cls.vessel,
                    cls.conn.space_center.vessels)))
コード例 #10
0
ファイル: test_autopilot.py プロジェクト: pipi1226/krpc
 def setUpClass(cls):
     testingtools.new_save()
     testingtools.remove_other_vessels()
     testingtools.launch_vessel_from_vab('Basic')
     testingtools.set_orbit('Eve', 1070000, 0.15, 16.2, 70.5, 180.8, 1.83,
                            251.1)
     cls.conn = testingtools.connect()
     cls.vessel = cls.conn.space_center.active_vessel
     cls.ap = cls.vessel.auto_pilot
     cls.sas_mode = cls.conn.space_center.SASMode
     cls.speed_mode = cls.conn.space_center.SpeedMode
     cls.ap.rotation_speed_multiplier = 2
     cls.ap.roll_speed_multiplier = 2
     cls.ap.set_pid_parameters(3, 0, 0)
コード例 #11
0
ファイル: test_orbit.py プロジェクト: rosalesr/krpc
 def test_vessel_orbiting_bop(self):
     testingtools.set_orbit("Bop", 320000, 0.18, 27, 38, 241, 2.3, 0)
     vessel = self.conn.space_center.active_vessel
     orbit = vessel.orbit
     self.assertEqual("Bop", orbit.body.name)
     self.assertClose(377600, orbit.apoapsis, error=50)
     self.assertClose(262400, orbit.periapsis, error=50)
     self.assertClose(377600 - 65000, orbit.apoapsis_altitude, error=50)
     self.assertClose(262400 - 65000, orbit.periapsis_altitude, error=50)
     sma = 0.5 * (377600 + 262400)
     e = 0.18
     self.assertClose(sma, orbit.semi_major_axis, error=50)
     self.assertClose(sma * math.sqrt(1 - (e * e)), orbit.semi_minor_axis, error=50)
     # self.check_radius_and_speed(vessel, orbit)
     self.check_time_to_apoapsis_and_periapsis(vessel, orbit)
     # self.assertTrue(math.isnan(orbit.time_to_soi_change))
     self.assertClose(e, orbit.eccentricity, error=0.1)
     self.assertClose(27 * (math.pi / 180), orbit.inclination, error=0.1)
     # self.assertClose(38 * (math.pi/180), orbit.longitude_of_ascending_node, error=0.1)
     # self.assertClose(241 * (math.pi/180), orbit.argument_of_periapsis, error=0.1)
     # self.assertClose(2.3, orbit.mean_anomaly_at_epoch, error=0.2)
     # self.assertClose(0, orbit.epoch, error=0.1)
     self.check_anomalies(vessel, orbit)
コード例 #12
0
ファイル: test_flight.py プロジェクト: rosalesr/krpc
 def test_vertical_speed_negative(self):
     testingtools.set_orbit('Kerbin', 700000, 0.2, 0, 0, 0, 0.2, 0)
     ref = self.vessel.orbit.body.reference_frame
     flight = self.vessel.flight(ref)
     self.assertGreater(0, flight.vertical_speed)
     self.check_speed(flight, ref)
コード例 #13
0
 def test_vertical_speed_negative(self):
     testingtools.set_orbit('Kerbin', 2000000, 0.2, 0, 0, 0, 2, 0)
     ref = self.vessel.orbit.body.reference_frame
     flight = self.vessel.flight(ref)
     self.assertGreater(0, flight.vertical_speed)
     self.check_speed(flight, ref)