@@ -47,6 +47,23 @@ class SuperNodeMediator
4747 ros::Time last_contact; // last time a message was received from the node
4848 };
4949
50+ /* *
51+ * Describes the platform configuration for the hardware running AMROS.
52+ * maker-model-app
53+ * Some variants are just the maker, some maker-model.
54+ * Sometimes a variant may provide just the app, indiciating the app could be flown on different platforms.
55+ */
56+ struct PlatformVariant
57+ {
58+ /* * the manufacture of the drone (DJI, ACSL)*/
59+ std::string maker;
60+ /* * The product name of the drone specific to the maker (m210,m300,mini,pf2)*/
61+ std::string model;
62+ /* * The application configuration for the mission (bridge, subt, etc). */
63+ std::string app;
64+
65+ };
66+
5067 struct Supervisor
5168 {
5269 /* * map of all nodes in the system*/
@@ -288,6 +305,31 @@ class SuperNodeMediator
288305 */
289306 bool forceTransition (const SuperState& to_state);
290307
308+ /* *
309+ * Validates the actual platform matches the required.
310+ * Empty required platform will always return true.
311+ * App provided by itself will ensure the app is correct without concern for the maker/model.
312+ * dji_m300_bridge and acsl_pf2_bridge will both pass required app=bridge
313+ *
314+ * @returns true if the running platform has matching components for that required
315+ */
316+ bool isCorrectPlatform (const PlatformVariant &required, const PlatformVariant &actual);
317+
318+ /* * Given the string in the configurations, the variant given
319+ * is populated with the components parsed from the config
320+ * dji_m300 -> maker=dji,model=m300,app=""
321+ * dji_m300_bridge -> ...,app=bridge
322+ * */
323+ void platformConfigToVariant (const std::string config, PlatformVariant &variant);
324+
325+ /* *
326+ * Converts the platform struct into a single string, separated by underscores
327+ * {maker}
328+ * {maker}_{model}
329+ * {maker}_{model}_{app}
330+ */
331+ std::string platformVariantToConfig (const PlatformVariant &variant);
332+
291333private:
292334 /* * name of supervisor node */
293335 const std::string SUPER_NODE_NAME;
0 commit comments