Source code for mds_api.mds_part_config

import json

from mds_api import client
from mds_api.NetworkConfiguration import NetworkConfiguration

[docs] def create_thruster_config_dict(position = None, rotation = None, XPlus = None, XMinus = None, YPlus = None, YMinus = None, ZPlus = None, ZMinus = None): """ Create the dict that holds the knowledge of configuration""" dct = {} if position is not None: dct["position"] = position if rotation is not None: dct["rotation"] = rotation if XPlus is not None: dct["enableXPlus"] = XPlus if XMinus is not None: dct["enableXMinus"] = XMinus if YPlus is not None: dct["enableYPlus"] = YPlus if YMinus is not None: dct["enableYMinus"] = YMinus if ZPlus is not None: dct["enableZPlus"] = ZPlus if ZMinus is not None: dct["enableZMinus"] = ZMinus return dct
[docs] def add_thrusters(sat_name: str, thruster_config: list, main_thrusters: bool = False) -> bytes: """ Add new RCS thrusters for the satellite. @param sat_name: name of the satellite for which the thrusters are being added. @param thruster_config: list of thruster configs to add. Each member must be a dict with parameters, use create_thruster_config_dict() function to create such a dict @param """ data = {} data["action"]="add_thrusters" data["name"] = sat_name data["thruster_kind"] = "rcs" if not main_thrusters else "main" data["thruster_data"] = {n: thruster_config[n] for n in range(len(thruster_config))} json_data = json.dumps(data) response = client.config_thrusters(json_data, NetworkConfiguration.MDS_HOST, NetworkConfiguration.MDS_HOST_PORT) return response
[docs] def configure_rcs_thrusters(sat_name:str, configs: dict) -> bytes: """ Configure RCS thruster params. You can set new position, rotation or enable/disable firing directions. @param sat_name: name of the satellite for which you are configuring. @param configs: a dict with key being the index of a thruster, and value being a dict with data for corresponding thruster. You may use create_thruster_config_dict() function to create such a dict. """ data = {} data["action"]="configure_thrusters" data["name"] = sat_name data["thruster_kind"] = "rcs" data["thruster_data"] = configs json_data = json.dumps(data) response = client.config_thrusters(json_data, NetworkConfiguration.MDS_HOST, NetworkConfiguration.MDS_HOST_PORT) return response