Merge lp:~petr-kubanek/stellarium/stellarium into lp:stellarium

Proposed by Petr Kubánek
Status: Merged
Merged at revision: 9290
Proposed branch: lp:~petr-kubanek/stellarium/stellarium
Merge into: lp:stellarium
Diff against target: 230 lines (+41/-18)
12 files modified
data/base_locations.txt (+1/-0)
plugins/Satellites/src/Satellite.cpp (+3/-0)
plugins/TelescopeControl/src/TelescopeControl.cpp (+3/-3)
plugins/TelescopeControl/src/TelescopeControl.hpp (+2/-1)
plugins/TelescopeControl/src/clients/TelescopeClient.cpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClient.hpp (+3/-3)
plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.cpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.hpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.cpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.hpp (+1/-1)
plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp (+23/-5)
plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp (+1/-1)
To merge this branch: bzr merge lp:~petr-kubanek/stellarium/stellarium
Reviewer Review Type Date Requested Status
gzotti Approve
Review via email: mp+322593@code.launchpad.net

Description of the change

As RTS2 telescopes supports internally TLE tracking, I added StelObjectP to telescopeGoto. If the object is satellite (currently based on tle1 and tle2 keys in getInfoMap), RTS2 clients uses move_tle command instead of move command to synchronize on satellite.

To post a comment you must log in.
Revision history for this message
Petr Kubánek (petr-kubanek) wrote :

Added docs.

9283. By Alexander Wolf

Apply translations for public testing (v0.90.0.9283); Added improvements for AstroCalc tool

9284. By Alexander Wolf

Updated templates for translation

9285. By Alexander Wolf

Updated time steps for AstroCalc/Ephemeris tool

9286. By Alexander Wolf

Avoid warnings

9287. By Alexander Wolf

Fixed stupid bug

9288. By Alexander Wolf

Added a line for the approximate time of the meridian crossing in AstroCalc tool

9289. By Alexander Wolf

A small improvement for previous fix

Revision history for this message
gzotti (georg-zotti) wrote :

TLE Tracking, WOW!

Time to build an RTS2 system... :-D

What can I say but accept?

I will be mostly offline until May, if you develop further, we are in no hurry about merging.

review: Approve
9290. By Petr Kubanek

Telescope+Satellites plugin: Add TLE tracking to RTS2 telescopes!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/base_locations.txt'
2--- data/base_locations.txt 2017-02-06 16:28:22 +0000
3+++ data/base_locations.txt 2017-04-15 17:06:31 +0000
4@@ -23409,6 +23409,7 @@
5 Cape Town Western Cape za R 3433.441 33.92584S 18.42322E 25 9 Africa/Johannesburg
6 Atlantis Western Cape za N 60.266 33.56668S 18.48335E 178 6 Africa/Johannesburg
7 Rondebosch Western Cape za N 15.158 33.96333S 18.47639E 28 5 Africa/Johannesburg
8+SAAO Sutherland Western Cape za O 0 32.38722S 20.81167E 1798 1 Africa/Johannesburg
9 Midstream Gauteng za N 25 25.91849S 28.19881E 1495 5 Africa/Johannesburg
10 Retreat Western Cape za N 32.289 34.05515S 18.47617E 8 5 Africa/Johannesburg
11 Diepsloot Gauteng za N 350 25.93312S 28.01213E 1410 7 Africa/Johannesburg
12
13=== modified file 'plugins/Satellites/src/Satellite.cpp'
14--- plugins/Satellites/src/Satellite.cpp 2017-03-24 02:23:38 +0000
15+++ plugins/Satellites/src/Satellite.cpp 2017-04-15 17:06:31 +0000
16@@ -401,6 +401,9 @@
17
18 map.insert("description", QString(description).replace("\n", " - "));
19 map.insert("catalog", id);
20+ map.insert("tle1", tleElements.first.data());
21+ map.insert("tle2", tleElements.second.data());
22+
23 if (!internationalDesignator.isEmpty())
24 map.insert("international-designator", internationalDesignator);
25
26
27=== modified file 'plugins/TelescopeControl/src/TelescopeControl.cpp'
28--- plugins/TelescopeControl/src/TelescopeControl.cpp 2017-04-07 02:49:45 +0000
29+++ plugins/TelescopeControl/src/TelescopeControl.cpp 2017-04-15 17:06:31 +0000
30@@ -389,7 +389,7 @@
31
32 Vec3d objectPosition = selectObject->getJ2000EquatorialPos(StelApp::getInstance().getCore());
33
34- telescopeGoto(idx, objectPosition);
35+ telescopeGoto(idx, objectPosition, selectObject);
36 }
37
38 void TelescopeControl::slewTelescopeToViewDirection(const int idx)
39@@ -425,11 +425,11 @@
40 #endif //COMPATIBILITY_001002
41 }
42
43-void TelescopeControl::telescopeGoto(int slotNumber, const Vec3d &j2000Pos)
44+void TelescopeControl::telescopeGoto(int slotNumber, const Vec3d &j2000Pos, StelObjectP selectObject)
45 {
46 //TODO: See the original code. I think that something is wrong here...
47 if(telescopeClients.contains(slotNumber))
48- telescopeClients.value(slotNumber)->telescopeGoto(j2000Pos);
49+ telescopeClients.value(slotNumber)->telescopeGoto(j2000Pos, selectObject);
50 }
51
52 void TelescopeControl::communicate(void)
53
54=== modified file 'plugins/TelescopeControl/src/TelescopeControl.hpp'
55--- plugins/TelescopeControl/src/TelescopeControl.hpp 2017-04-07 02:49:45 +0000
56+++ plugins/TelescopeControl/src/TelescopeControl.hpp 2017-04-15 17:06:31 +0000
57@@ -98,7 +98,8 @@
58 //! Send a J2000-goto-command to the specified telescope
59 //! @param telescopeNr the number of the telescope
60 //! @param j2000Pos the direction in equatorial J2000 frame
61- void telescopeGoto(int telescopeNr, const Vec3d &j2000Pos);
62+ //! @param selectObject selected object (if any; NULL if move is not based on an object)
63+ void telescopeGoto(int telescopeNr, const Vec3d &j2000Pos, StelObjectP selectObject = NULL);
64
65 //! Remove all currently registered telescopes
66 void deleteAllTelescopes();
67
68=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.cpp'
69--- plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2017-04-13 14:10:42 +0000
70+++ plugins/TelescopeControl/src/clients/TelescopeClient.cpp 2017-04-15 17:06:31 +0000
71@@ -265,7 +265,7 @@
72 //! queues a GOTO command with the specified position to the write buffer.
73 //! For the data format of the command see the
74 //! "Stellarium telescope control protocol" text file
75-void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos)
76+void TelescopeTCP::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
77 {
78 if (!isConnected())
79 return;
80
81=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.hpp'
82--- plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2017-04-15 10:00:10 +0000
83+++ plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2017-04-15 17:06:31 +0000
84@@ -77,7 +77,7 @@
85 virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
86
87 // Methods specific to telescope
88- virtual void telescopeGoto(const Vec3d &j2000Pos) = 0;
89+ virtual void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject) = 0;
90 virtual bool isConnected(void) const = 0;
91 virtual bool hasKnownPosition(void) const = 0;
92 void addOcular(double fov) {if (fov>=0.0) oculars.push_back(fov);}
93@@ -134,7 +134,7 @@
94 XYZ = desired_pos;
95 return true;
96 }
97- void telescopeGoto(const Vec3d &j2000Pos)
98+ void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
99 {
100 desired_pos = j2000Pos;
101 desired_pos.normalize();
102@@ -177,7 +177,7 @@
103 Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
104 bool prepareCommunication();
105 void performCommunication();
106- void telescopeGoto(const Vec3d &j2000Pos);
107+ void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
108 bool isInitialized(void) const
109 {
110 return (!address.isNull());
111
112=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.cpp'
113--- plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.cpp 2017-03-13 11:34:19 +0000
114+++ plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.cpp 2017-04-15 17:06:31 +0000
115@@ -98,7 +98,7 @@
116 }
117
118 //! queues a GOTO command
119-void TelescopeClientDirectLx200::telescopeGoto(const Vec3d &j2000Pos)
120+void TelescopeClientDirectLx200::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
121 {
122 if (!isConnected())
123 return;
124
125=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.hpp'
126--- plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.hpp 2012-01-11 10:50:37 +0000
127+++ plugins/TelescopeControl/src/clients/TelescopeClientDirectLx200.hpp 2017-04-15 17:06:31 +0000
128@@ -68,7 +68,7 @@
129 Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
130 bool prepareCommunication();
131 void performCommunication();
132- void telescopeGoto(const Vec3d &j2000Pos);
133+ void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
134 bool isInitialized(void) const;
135
136 //======================================================================
137
138=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.cpp'
139--- plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.cpp 2017-03-13 11:34:19 +0000
140+++ plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.cpp 2017-04-15 17:06:31 +0000
141@@ -94,7 +94,7 @@
142 }
143
144 //! queues a GOTO command
145-void TelescopeClientDirectNexStar::telescopeGoto(const Vec3d &j2000Pos)
146+void TelescopeClientDirectNexStar::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
147 {
148 if (!isConnected())
149 return;
150
151=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.hpp'
152--- plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.hpp 2012-01-11 10:50:37 +0000
153+++ plugins/TelescopeControl/src/clients/TelescopeClientDirectNexStar.hpp 2017-04-15 17:06:31 +0000
154@@ -68,7 +68,7 @@
155 Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
156 bool prepareCommunication();
157 void performCommunication();
158- void telescopeGoto(const Vec3d &j2000Pos);
159+ void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
160 bool isInitialized(void) const;
161
162 //======================================================================
163
164=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp'
165--- plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp 2017-04-14 00:32:54 +0000
166+++ plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.cpp 2017-04-15 17:06:31 +0000
167@@ -166,6 +166,7 @@
168 {
169 qWarning() << "TelescopeRTS2(" << name << ")::replyFinished: unhandled reply: " << reply->url().toString();
170 }
171+ reply->deleteLater();
172 }
173
174 bool TelescopeClientJsonRts2::isConnected(void) const
175@@ -180,20 +181,37 @@
176 return interpolatedPosition.get(now);
177 }
178
179-void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos)
180+void TelescopeClientJsonRts2::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
181 {
182 if (!isConnected())
183 return;
184
185- double ra, dec;
186- StelUtils::rectToSphe(&ra, &dec, j2000Pos);
187-
188 QUrl set(baseurl);
189 set.setPath(baseurl.path() + "/api/cmd");
190
191 QUrlQuery query;
192 query.addQueryItem("d", telName);
193- query.addQueryItem("c", QString("move+%1+%2").arg(ra * 180 / M_PI).arg(dec * 180 / M_PI));
194+
195+ bool commanded = false;
196+
197+ // if it's satellite, use move_tle
198+ if (selectObject)
199+ {
200+ QVariantMap objectMap = selectObject->getInfoMap(StelApp::getInstance().getCore());
201+ if (objectMap.contains("tle1") && objectMap.contains("tle2"))
202+ {
203+ query.addQueryItem("c", QString("move_tle+%22") + objectMap["tle1"].toString() + QString("%22+%22") + objectMap["tle2"].toString() + QString("%22"));
204+ commanded = true;
205+ }
206+ }
207+
208+ if (commanded == false)
209+ {
210+ double ra, dec;
211+ StelUtils::rectToSphe(&ra, &dec, j2000Pos);
212+
213+ query.addQueryItem("c", QString("move+%1+%2").arg(ra * 180 / M_PI).arg(dec * 180 / M_PI));
214+ }
215 set.setQuery(query);
216
217 QNetworkRequest setR;
218
219=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp'
220--- plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp 2017-04-13 14:10:42 +0000
221+++ plugins/TelescopeControl/src/clients/TelescopeClientJsonRts2.hpp 2017-04-15 17:06:31 +0000
222@@ -42,7 +42,7 @@
223
224 Vec3d getJ2000EquatorialPos(const StelCore* core=0) const;
225
226- void telescopeGoto(const Vec3d &j2000Pos);
227+ void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
228 bool hasKnownPosition(void) const;
229
230 protected: