Add duration to pointing event

This commit is contained in:
Malin E
2022-04-19 11:26:16 +02:00
parent 36a4ba53d4
commit 3e81092c68
3 changed files with 16 additions and 5 deletions

View File

@@ -1,12 +1,15 @@
local point_jwst = {
Identifier = "event.jwst.point",
Name = "Point JWST",
Command = [[
local ra
local dec
local duration
if is_declared("args") then
ra = args.Ra
dec = args.Dec
duration = args.Duration
else
return
end
@@ -128,7 +131,7 @@ local point_jwst = {
openspace.setPropertyValueSingle(
'Scene.JWSTModel.Rotation.Rotation',
{ JWSTAngles[1], JWSTAngles[2], 0.0},
3.0
duration
)
]],
Documentation = [[

View File

@@ -380,17 +380,20 @@ struct EventSessionRecordingPlayback : public Event {
/**
* This event is created when a request for pointing the JWST model to a Ra Dec coordinate
* in the sky is issued. The event contains information about the sky coordinate to point
* the JWST towards.
* the JWST towards and an optional argument for the duration it should do the pointing.
*
* \param Ra The Ra part of the sky coordinate in decimal degrees to point the JWST to
* \param Dec The Dec part of the sky coordinate in decimal degrees to point the JWST to
* \param Duration The duration of time in seconds that the telescope should redirect
* itself to the coordinate. Default is 3 seconds
*/
struct EventPointJwstRequested : public Event {
static const Type Type = Event::Type::PointJwstRequested;
EventPointJwstRequested(double ra_, double dec_);
EventPointJwstRequested(double ra_, double dec_, double duration_ = 3.0);
const double ra;
const double dec;
const double duration;
};
/**

View File

@@ -173,7 +173,10 @@ void log(int i, const EventSessionRecordingPlayback& e) {
void log(int i, const EventPointJwstRequested& e) {
ghoul_assert(e.type == EventPointJwstRequested::Type, "Wrong type");
LINFO(fmt::format("[{}] PointJwstRequested: Ra: {}, Dec: {}", i, e.ra, e.dec));
LINFO(fmt::format(
"[{}] PointJwstRequested: Ra: {}, Dec: {}, Duration: {}", i, e.ra, e.dec,
e.duration
));
}
void log(int i, const CustomEvent& e) {
@@ -423,6 +426,7 @@ ghoul::Dictionary toParameter(const Event& e) {
case Event::Type::PointJwstRequested:
d.setValue("Ra", static_cast<const EventPointJwstRequested&>(e).ra);
d.setValue("Dec", static_cast<const EventPointJwstRequested&>(e).dec);
d.setValue("Duration", static_cast<const EventPointJwstRequested&>(e).duration);
break;
case Event::Type::Custom:
d.setValue(
@@ -605,10 +609,11 @@ EventSessionRecordingPlayback::EventSessionRecordingPlayback(State state_)
, state(state_)
{}
EventPointJwstRequested::EventPointJwstRequested(double ra_, double dec_)
EventPointJwstRequested::EventPointJwstRequested(double ra_, double dec_, double duration_)
: Event(Type)
, ra(ra_)
, dec(dec_)
, duration(duration_)
{}
CustomEvent::CustomEvent(std::string_view subtype_, std::string_view payload_)