Running Satellite Communications Toolbox with Python API

I have 4 scripts, 2 in python and 2 in matlab, that I use to create operational schedules for a satellite. I am relatively new to coding, and have made things messy (I have to run all 4 in a specific order to obtain my desired output of a .csv file containing the schedule). In an effort to make things more efficeint, I am trying to use the MATLAB Python API to combine all 4 into 1 python file. When I run the following,
import matlab.engine
eng = matlab.engine.start_matlab()
eng.mainTwo(nargout=0)
I get the follwoing error: (it should be noted 'mainTwo.m' is the first of the four scripts I run, bad naming I know)
Error using satelliteScenario/groundStation
Invalid default value for property 'ColorConverter' in class 'matlabshared.satellitescenario.ScenarioGraphic':
Error defining property 'ConvertedColor' of class 'matlabshared.satellitescenario.internal.ColorConverter'. Class named 'matlab.graphics.datatype.RGBColor' is undefined or does not support property validation.
Error in mainTwo (line 39)
UGA = groundStation(sc, lat(84), long(84), 'Name', ...
Traceback (most recent call last):
File "c:/Users/Supreme/Desktop/STKIntegration/Repository/matlabMociScheduler/combined.py", line 3, in <module>
eng.mainTwo(nargout=0)
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\matlabengine.py", line 70, in __call__
return FutureResult(self._engine(), future, nargs, _stdout,
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\futureresult.py", line 67, in result
return self.__future.result(timeout)
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\fevalfuture.py", line 82, in result
self._result = pythonengine.getFEvalResult(self._future,self._nargout, None, out=self._out, err=self._err)
matlab.engine.MatlabExecutionError:
File C:\Program Files\MATLAB\toolbox\shared\orbit\@satelliteScenario\groundStation.p,
line 0, in groundStation
File C:\Users\Supreme\Desktop\STKIntegration\Repository\matlabMociScheduler\mainTwo.m, line 39, in mainTwo
Invalid default value for property 'ColorConverter' in class 'matlabshared.satellitescenario.ScenarioGraphic':
Error defining property 'ConvertedColor' of class 'matlabshared.satellitescenario.internal.ColorConverter'. Class named 'matlab.graphics.datatype.RGBColor' is undefined or does not support property validation.
This is the line in question, line 39:
UGA = groundStation(sc, lat(84), long(84), 'Name', ...
name, "MinElevationAngle", minElevationAngle);
I have not seen anyone else using the Python API to run scipts using the Satellite Communications Toolbox, so I really have no reference when trouble shooting. I assume this is because the toolbox is relatively new? It should also be noted that 'mainTwo.m' runs with no errors when ran inside matlab, but obviously when ran with the API is produces an error when creating the ground station object. Any thoughts?

3 件のコメント

Yongjian Feng
Yongjian Feng 2021 年 7 月 15 日
Seems like you want to call all four scripts from python.
How about calling all scripts from matlab?
Ryan Hughes
Ryan Hughes 2021 年 7 月 15 日
編集済み: Ryan Hughes 2021 年 7 月 15 日
@Yongjian Feng My reasoning for going to python instead of matlab, and even creating the python scripts in the first place, was because I used prewritten python files that instake the access intervals, sort them chronologically, and produce a schedule .csv file with satellite modes, target names, etc. In the past I used the STK Python API to produce the operational schedules but my organization ran into some licensing issues so we are transitioning to matlab for sims.
If I stayed in matlab I would need to write the matlab equivalent of those prewritten files, which I assume is possible but was hoping to keep everything in python to save time. This error message is confusing me though, with it showing up through the API and not when ran in matlab.
William Hunter
William Hunter 2021 年 10 月 14 日
Any progress on this issue? I can cause the same error with this very simple example:
parfor idx = 1:1
sc = satelliteScenario();
gs = sc.groundStation();
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

製品

リリース

R2021a

質問済み:

2021 年 7 月 14 日

コメント済み:

2021 年 10 月 14 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by