Commit 0c9ed76c authored by Luca Cristaldi's avatar Luca Cristaldi

add argparse magic

parent b2855ca7
import krpc
import zmq
import argparse
class ModelRocket:
......@@ -12,18 +13,21 @@ class ModelRocket:
def send(self,stage):
self.socket.send("%d %d" % (self.topic, self.stage_map[stage]))
def __init__(self,port=5556):
def __init__(self,addr="localhos:5556"):
context = zmq.Context()
self.socket = context.socket(zmq.PUB)
self.socket.bind("tcp://*:%s" % port)
self.socket.bind("tcp://%s" % addr)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='')
parser.add_argument('addr', type=str, default="localhos:5556", nargs="?")
args = parser.parse_args()
conn = krpc.connect()
vessel = conn.space_center.active_vessel
control = vessel.control
rocket = ModelRocket()
rocket = ModelRocket(args.addr)
stage = conn.add_stream(getattr, control.current_stage, 'stage')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment