Actions

The event panel also enables particular actions to be executed. These actions are specific to the component and not all components have actions. An action could be one of the following and is dependent on the component being used.

  • Solar Panel: Deploy and Retract the panels (for the Deployable one only)
  • Guidance Computer: Change the guidance pointing modes between SUN, NADIR and VELOCITY
  • Camera: Capture an image and display the output
  • Thruster: Fire the thruster for a few seconds

All events can be executed via MQTT when a specific message on a topic is subscribed to. In this tutorial, the deployable solar panel will be used and will be deployed and retracted via MQTT.


Configuring the Action

Returning to the spacecraft, the Solar Panel 3U XY Deployable component needs to be attached to the chassis. This is the only solar panel that has a deployment mechanism.

Once the solar panel is added, find the events tab in the properties panel under Spacecraft > Events. This is the same panel that was used in the previous tutorial. Create another event using the Add Event button at the top of the panel and add a new trigger and action under their sections. The name for the event can be Deploy and select MQTT as the trigger type. This will enable the event to be triggered from an MQTT call.

For the action, the type is Method and the Target is the Solar Panel 3U XY Deployable and the method to be called is Deploy.

NOTE

When publishing the data on the topic that defines the action to trigger, the action must be spelt the same and be case-sensitive. Any invalid event calls will result in no events being triggered.

The topic is the topic that will be subscribed to when listening for this component’s actions. For this tutorial, the topic name SolarPaneland the message Deploy will be used.

WARNING

It is recommended that the topic for this tutorial be changed from the ones added here when using a public broker, as it can listen to anyone publishing over that topic.

Create another event similar to the Deploy event but for the Retract method to retract the panels. The MQTT topic for the trigger will remain the same as SolarPanel however the message should be Retract.


Executing the Event

Once the event is configured, start the simulation and return to the public broker interface. Using the topic publish panel, enter SolarPanel as the topic and in the message, publish either Deploy or Retract. In the simulation, watching the spacecraft, the solar panel will perform the action when the message is received.

When the Deploy or Retract commands are parsed, the solar panel will execute those actions as expected. This same system will work with any component that has actions available.

NOTE

If the solar panel deploy or retract method is called again while their state is respectively deployed or retracted, the panels won’t do anything however the event is still recorded in the timeline.

When the commands are issued, the solar panel will deploy or retract the two panels, resulting in a change to the power draw from the spacecraft, which can be plotted using the graphing system. The final view includes 4 custom events added to the timeline.

NOTE

When calling MQTT events, the MQTT client must have been configured already. Failure to configure the client during the Studio session will result in no event being triggered.