JMOT.misc

 1from JMOT import connect, extra
 2import numpy as np
 3
 4_MISC_CONVERT_SIGNALS = {
 5    "position2LL_AGL":360,
 6    "position2LL_ASL":361,
 7    "LL_AGL2position":362,
 8    "LL_ASL2position":363,
 9    "cast_ray":364,
10}
11
12class convert:
13    def position2LL_AGL(position:np.ndarray)->np.ndarray:
14        '''Convert a position in ECI coordinates to latitude, longitude, and AGL.\n'''
15        vec = extra.array2tuple(position)
16        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_AGL']}<<{vec}")
17        return list(rec[0])
18    def position2LL_ASL(position:np.ndarray)->np.ndarray:
19        '''Convert a position in ECI coordinates to latitude, longitude, and ASL.\n'''
20        vec = extra.array2tuple(position)
21        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_ASL']}<<{vec}")
22        return list(rec[0])
23    def LL_AGL2position(position:np.ndarray)->np.ndarray:
24        '''Convert a position in latitude, longitude, and AGL to ECI coordinates.\n'''
25        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_AGL2position']}<<{tuple(position)}")
26        vec = extra.tuple2array(rec[0])
27        return vec
28    def LL_ASL2position(position:np.ndarray)->np.ndarray:
29        '''Convert a position in latitude, longitude, and ASL to ECI coordinates.\n'''
30        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_ASL2position']}<<{tuple(position)}")
31        vec = extra.tuple2array(rec[0])
32        return vec
33    def cast_ray(vec1:np.ndarray, vec2:np.ndarray)->np.ndarray:
34        '''Cast a ray from vec1 to vec2, and return the position of the first collision in ECI coordinates.\n
35        if length out of 100km, return 0.\n'''
36        vec1 = extra.array2tuple(vec1)
37        vec2 = extra.array2tuple(vec2)
38        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['cast_ray']}<<{vec1}<<{vec2}")
39        vec = extra.tuple2array(rec)
40        return vec
41
42
43_MISC_CAMERA_SIGNALS = {
44    "camera_position":370,
45    "camera_pointing":371,
46    "camera_direction":372
47}
48
49class camera:
50    def camera_position()->np.ndarray:
51        '''Get the current camera position in ECI coordinates.'''
52        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_position']}")
53        vec = extra.tuple2array(rec)
54        return vec
55    def camera_pointing()->np.ndarray:
56        '''Get the current camera pointing direction in ECI coordinates.'''
57        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_pointing']}")
58        vec = extra.tuple2array(rec)
59        return vec
60    def camera_direction()->np.ndarray:
61        '''Get the current camera direction in ECI coordinates.'''
62        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_direction']}")
63        vec = extra.tuple2array(rec)
64        return vec
65
66_MISC_FUNK_SIGNALS = {
67    "get_float":373,
68    "get_bool":373,
69    "get_string":373,
70    "get_int":373
71}
72
73class funk:
74    def get_float(funkexpression:str)->float:
75        '''Get the value of a funk expression as a float.\n'''
76        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_float']}<<{funkexpression}")
77        return rec[0]
78    def get_bool(funkexpression:str)->bool:
79        '''Get the value of a funk expression as a boolean.\n'''
80        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_bool']}<<{funkexpression}")
81        return bool(rec[0])
82    def get_string(funkexpression:str)->str:
83        '''Get the value of a funk expression as a string.\n'''
84        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_string']}<<{funkexpression}")
85        return rec[0]
86    def get_int(funkexpression:str)->int:
87        '''Get the value of a funk expression as an integer.\n'''
88        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_int']}<<{funkexpression}")
89        return rec[0]
90    def get_vector(funkexpression:str)->np.ndarray:
91        '''Get the value of a funk expression as a vector in ECI coordinates.\n'''
92        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_vector']}<<{funkexpression}")
93        return extra.tuple2array(rec[0])
class convert:
13class convert:
14    def position2LL_AGL(position:np.ndarray)->np.ndarray:
15        '''Convert a position in ECI coordinates to latitude, longitude, and AGL.\n'''
16        vec = extra.array2tuple(position)
17        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_AGL']}<<{vec}")
18        return list(rec[0])
19    def position2LL_ASL(position:np.ndarray)->np.ndarray:
20        '''Convert a position in ECI coordinates to latitude, longitude, and ASL.\n'''
21        vec = extra.array2tuple(position)
22        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_ASL']}<<{vec}")
23        return list(rec[0])
24    def LL_AGL2position(position:np.ndarray)->np.ndarray:
25        '''Convert a position in latitude, longitude, and AGL to ECI coordinates.\n'''
26        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_AGL2position']}<<{tuple(position)}")
27        vec = extra.tuple2array(rec[0])
28        return vec
29    def LL_ASL2position(position:np.ndarray)->np.ndarray:
30        '''Convert a position in latitude, longitude, and ASL to ECI coordinates.\n'''
31        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_ASL2position']}<<{tuple(position)}")
32        vec = extra.tuple2array(rec[0])
33        return vec
34    def cast_ray(vec1:np.ndarray, vec2:np.ndarray)->np.ndarray:
35        '''Cast a ray from vec1 to vec2, and return the position of the first collision in ECI coordinates.\n
36        if length out of 100km, return 0.\n'''
37        vec1 = extra.array2tuple(vec1)
38        vec2 = extra.array2tuple(vec2)
39        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['cast_ray']}<<{vec1}<<{vec2}")
40        vec = extra.tuple2array(rec)
41        return vec
def position2LL_AGL(position: numpy.ndarray) -> numpy.ndarray:
14    def position2LL_AGL(position:np.ndarray)->np.ndarray:
15        '''Convert a position in ECI coordinates to latitude, longitude, and AGL.\n'''
16        vec = extra.array2tuple(position)
17        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_AGL']}<<{vec}")
18        return list(rec[0])

Convert a position in ECI coordinates to latitude, longitude, and AGL.

def position2LL_ASL(position: numpy.ndarray) -> numpy.ndarray:
19    def position2LL_ASL(position:np.ndarray)->np.ndarray:
20        '''Convert a position in ECI coordinates to latitude, longitude, and ASL.\n'''
21        vec = extra.array2tuple(position)
22        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['position2LL_ASL']}<<{vec}")
23        return list(rec[0])

Convert a position in ECI coordinates to latitude, longitude, and ASL.

def LL_AGL2position(position: numpy.ndarray) -> numpy.ndarray:
24    def LL_AGL2position(position:np.ndarray)->np.ndarray:
25        '''Convert a position in latitude, longitude, and AGL to ECI coordinates.\n'''
26        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_AGL2position']}<<{tuple(position)}")
27        vec = extra.tuple2array(rec[0])
28        return vec

Convert a position in latitude, longitude, and AGL to ECI coordinates.

def LL_ASL2position(position: numpy.ndarray) -> numpy.ndarray:
29    def LL_ASL2position(position:np.ndarray)->np.ndarray:
30        '''Convert a position in latitude, longitude, and ASL to ECI coordinates.\n'''
31        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['LL_ASL2position']}<<{tuple(position)}")
32        vec = extra.tuple2array(rec[0])
33        return vec

Convert a position in latitude, longitude, and ASL to ECI coordinates.

def cast_ray(vec1: numpy.ndarray, vec2: numpy.ndarray) -> numpy.ndarray:
34    def cast_ray(vec1:np.ndarray, vec2:np.ndarray)->np.ndarray:
35        '''Cast a ray from vec1 to vec2, and return the position of the first collision in ECI coordinates.\n
36        if length out of 100km, return 0.\n'''
37        vec1 = extra.array2tuple(vec1)
38        vec2 = extra.array2tuple(vec2)
39        rec = connect._send_message(f"true<<{_MISC_CONVERT_SIGNALS['cast_ray']}<<{vec1}<<{vec2}")
40        vec = extra.tuple2array(rec)
41        return vec

Cast a ray from vec1 to vec2, and return the position of the first collision in ECI coordinates.

if length out of 100km, return 0.

class camera:
50class camera:
51    def camera_position()->np.ndarray:
52        '''Get the current camera position in ECI coordinates.'''
53        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_position']}")
54        vec = extra.tuple2array(rec)
55        return vec
56    def camera_pointing()->np.ndarray:
57        '''Get the current camera pointing direction in ECI coordinates.'''
58        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_pointing']}")
59        vec = extra.tuple2array(rec)
60        return vec
61    def camera_direction()->np.ndarray:
62        '''Get the current camera direction in ECI coordinates.'''
63        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_direction']}")
64        vec = extra.tuple2array(rec)
65        return vec
def camera_position() -> numpy.ndarray:
51    def camera_position()->np.ndarray:
52        '''Get the current camera position in ECI coordinates.'''
53        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_position']}")
54        vec = extra.tuple2array(rec)
55        return vec

Get the current camera position in ECI coordinates.

def camera_pointing() -> numpy.ndarray:
56    def camera_pointing()->np.ndarray:
57        '''Get the current camera pointing direction in ECI coordinates.'''
58        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_pointing']}")
59        vec = extra.tuple2array(rec)
60        return vec

Get the current camera pointing direction in ECI coordinates.

def camera_direction() -> numpy.ndarray:
61    def camera_direction()->np.ndarray:
62        '''Get the current camera direction in ECI coordinates.'''
63        rec = connect._send_message(f"true<<{_MISC_CAMERA_SIGNALS['camera_direction']}")
64        vec = extra.tuple2array(rec)
65        return vec

Get the current camera direction in ECI coordinates.

class funk:
74class funk:
75    def get_float(funkexpression:str)->float:
76        '''Get the value of a funk expression as a float.\n'''
77        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_float']}<<{funkexpression}")
78        return rec[0]
79    def get_bool(funkexpression:str)->bool:
80        '''Get the value of a funk expression as a boolean.\n'''
81        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_bool']}<<{funkexpression}")
82        return bool(rec[0])
83    def get_string(funkexpression:str)->str:
84        '''Get the value of a funk expression as a string.\n'''
85        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_string']}<<{funkexpression}")
86        return rec[0]
87    def get_int(funkexpression:str)->int:
88        '''Get the value of a funk expression as an integer.\n'''
89        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_int']}<<{funkexpression}")
90        return rec[0]
91    def get_vector(funkexpression:str)->np.ndarray:
92        '''Get the value of a funk expression as a vector in ECI coordinates.\n'''
93        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_vector']}<<{funkexpression}")
94        return extra.tuple2array(rec[0])
def get_float(funkexpression: str) -> float:
75    def get_float(funkexpression:str)->float:
76        '''Get the value of a funk expression as a float.\n'''
77        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_float']}<<{funkexpression}")
78        return rec[0]

Get the value of a funk expression as a float.

def get_bool(funkexpression: str) -> bool:
79    def get_bool(funkexpression:str)->bool:
80        '''Get the value of a funk expression as a boolean.\n'''
81        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_bool']}<<{funkexpression}")
82        return bool(rec[0])

Get the value of a funk expression as a boolean.

def get_string(funkexpression: str) -> str:
83    def get_string(funkexpression:str)->str:
84        '''Get the value of a funk expression as a string.\n'''
85        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_string']}<<{funkexpression}")
86        return rec[0]

Get the value of a funk expression as a string.

def get_int(funkexpression: str) -> int:
87    def get_int(funkexpression:str)->int:
88        '''Get the value of a funk expression as an integer.\n'''
89        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_int']}<<{funkexpression}")
90        return rec[0]

Get the value of a funk expression as an integer.

def get_vector(funkexpression: str) -> numpy.ndarray:
91    def get_vector(funkexpression:str)->np.ndarray:
92        '''Get the value of a funk expression as a vector in ECI coordinates.\n'''
93        rec = connect._send_message(f"true<<{_MISC_FUNK_SIGNALS['get_vector']}<<{funkexpression}")
94        return extra.tuple2array(rec[0])

Get the value of a funk expression as a vector in ECI coordinates.