Пример #1
0
async def stop_reaction_wheels(rf_controller):
    try:
        log_info_message('Sending Start Reaction Wheel Command')
        await rf_controller.send(6)
        rf_controller.disable_receiver()
    except Exception as e:
        print('Error: ' + str(e))
Пример #2
0
async def ping(rf_controller):
    try:
        log_info_message('Sending Ping Command')
        timestamp = datetime.now()
        await rf_controller.send(1)
        while True:
            print('Waiting for response...')
            receive = await rf_controller.get_response(10, 1200)
            if receive == 1200:
                break
            else:
                print('Timed out - Retrying')
                await rf_controller.send(1)
        diff = (datetime.now() - timestamp).seconds
        print('Got response in {} seconds.'.format(str(diff)))
    except Exception as e:
        print('Error: ' + e)
Пример #3
0
 async def send(self, data):
     try:
         log_info_message('Sending ' + str(data))
         self.rfReceiver.disable_rx()
         await asyncio.sleep(0.01)
         self.rfTransmitter.enable_tx()
         await asyncio.sleep(0.01)
         self.rfTransmitter.tx_code(data, 1)
         await asyncio.sleep(0.01)
         self.rfTransmitter.disable_tx()
         await asyncio.sleep(0.01)
         self.rfReceiver.enable_rx()
         log_info_message('Sent Data')
         await asyncio.sleep(1)
     except Exception as e:
         print('Exception while sending - retrying: ' + str(e))
         await self.send(data)
Пример #4
0
async def get_reaction_wheel_status(rf_controller):
    try:
        log_info_message('Sending Get Reaction Wheel Command')
        await rf_controller.send(7)
        while True:
            print('Waiting for response...')
            receive = await rf_controller.get_response(10)
            if receive == 71:
                print('Reaction Wheels are Running')
                break
            elif receive == 70:
                print('Reaction Wheels are not running')
                break
            else:
                print('Timed out - Retrying')
                await rf_controller.send(5200)
    except Exception as e:
        print('Error: ' + str(e))
Пример #5
0
async def main():
    global rf_controller
    try:
        log_info_message('Starting Ground Control')

        log_info_message('Starting Rf Controller')
        rf_controller = rfController.RfController()

        log_info_message('Starting Cli')
        cli = Cli.CommandLine(rf_controller)
        cli_task = asyncio.create_task(cli.run_cli())

        await cli_task
    except Exception as e:
        print(e)
    except KeyboardInterrupt:
        rf_controller.exit()
        try:
            sys.exit(0)
        except SystemExit:
            os._exit(0)