packages feed

ogma-cli 1.0.6 → 1.0.7

raw patch · 5 files changed

+181/−2 lines, 5 filesdep ~ogma-core

Dependency ranges changed: ogma-core

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for ogma-cli +## [1.0.7] - 2023-01-21+* Version bump 1.0.7 (#69).+* Replace tabs in cabal file (#69).+* Introduce new ROS2 backend (#56).+ ## [1.0.6] - 2022-11-21  * Version bump 1.0.6 (#64).
ogma-cli.cabal view
@@ -32,7 +32,7 @@ build-type:          Simple  name:                ogma-cli-version:             1.0.6+version:             1.0.7 homepage:            http://nasa.gov license:             OtherLicense license-file:        LICENSE.pdf@@ -66,6 +66,11 @@                        applications to make external data in structs available                        to a Copilot monitor.                      .+                     - Generating+                       <https://ros.org Robot Operating System (ROS2)>+                       applications that use Copilot for monitoring data+                       received from different topics.+                     .                      The main invocation with @--help@ lists sub-commands available.                      .                      >$ ogma --help@@ -85,6 +90,7 @@                      >                           Specification                      >  fret-reqs-db             Generate a Copilot file from a FRET Requirements                      >                           Database+                     >  ros                      Generate a ROS2 monitoring application                      .                      For further information, see:                      .@@ -96,6 +102,8 @@                      .                      - <https://cfs.gsfc.nasa.gov/ The NASA Core Flight System web page>.                      .+                     - <https://ros.org/ The Robot Operating System (ROS2) web page>.+                     .                      - <https://ntrs.nasa.gov/citations/20200003164 "Copilot 3">, Perez, Dedden and Goodloe. 2020.                      .                      - <https://shemesh.larc.nasa.gov/people/cam/publications/FMAS2020_3.pdf "From Requirements to Autonomous Flight">, Dutle et al. 2020.@@ -111,13 +119,14 @@     CLI.CommandCStructs2MsgHandlers     CLI.CommandFretComponentSpec2Copilot     CLI.CommandFretReqsDB2Copilot+    CLI.CommandROSApp     CLI.CommandTop     CLI.Result    build-depends:       base                 >= 4.11.0.0 && < 5     , optparse-applicative-    , ogma-core            >= 1.0.0 && < 1.1+    , ogma-core            >= 1.0.7 && < 1.1    hs-source-dirs:     src
+ src/CLI/CommandROSApp.hs view
@@ -0,0 +1,148 @@+-- Copyright 2022 United States Government as represented by the Administrator+-- of the National Aeronautics and Space Administration. All Rights Reserved.+--+-- Disclaimers+--+-- No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY+-- OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT+-- LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO+-- SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A+-- PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE+-- SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF+-- PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN+-- ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR+-- RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR+-- ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER,+-- GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING+-- THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES+-- IT "AS IS."+--+-- Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST+-- THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS+-- ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN+-- ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,+-- INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S+-- USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE+-- UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY+-- PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY+-- FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS+-- AGREEMENT.+--+-- | CLI interface to the ROSApp subcommand.+module CLI.CommandROSApp+    (+      -- * Direct command access+      command+    , CommandOpts+    , ErrorCode++      -- * CLI+    , commandDesc+    , commandOptsParser+    )+  where++-- External imports+import Options.Applicative ( Parser, help, long, metavar, optional, showDefault,+                             strOption, value )++-- External imports: command results+import Command.Result ( Result )++-- External imports: actions or commands supported+import Command.ROSApp ( ErrorCode, rosApp )++-- * Command++-- | Options needed to generate the ROS application.+data CommandOpts = CommandOpts+  { rosAppTarget   :: String+  , rosAppFRETFile :: Maybe String+  , rosAppVarNames :: Maybe String+  , rosAppVarDB    :: Maybe String+  , rosAppHandlers :: Maybe String+  }++-- | Create <https://www.ros.org/ Robot Operating System> (ROS) applications+-- that subscribe to obtain necessary data from topics and call Copilot when+-- new data arrives.+--+-- This is just an uncurried version of "Command.ROSApp".+command :: CommandOpts -> IO (Result ErrorCode)+command c =+  rosApp+    (rosAppTarget c)+    (rosAppFRETFile c)+    (rosAppVarNames c)+    (rosAppVarDB c)+    (rosAppHandlers c)++-- * CLI++-- | ROS command description+commandDesc :: String+commandDesc = "Generate a ROS2 monitoring package"++-- | Subparser for the @ros@ command, used to generate a Robot Operating System+-- application connected to Copilot monitors.+commandOptsParser :: Parser CommandOpts+commandOptsParser = CommandOpts+  <$> strOption+        (  long "app-target-dir"+        <> metavar "DIR"+        <> showDefault+        <> value "ros"+        <> help strROSAppDirArgDesc+        )+  <*> optional+        ( strOption+            (  long "fret-file-name"+            <> metavar "FILENAME"+            <> help strROSAppFRETFileNameArgDesc+            )+        )+  <*> optional+        ( strOption+            (  long "variable-file"+            <> metavar "FILENAME"+            <> help strROSAppVarListArgDesc+            )+        )+  <*> optional+        ( strOption+            (  long "variable-db"+            <> metavar "FILENAME"+            <> help strROSAppVarDBArgDesc+            )+        )+  <*> optional+        ( strOption+            (  long "handlers-file"+            <> metavar "FILENAME"+            <> help strROSAppHandlerListArgDesc+            )+        )++-- | Argument target directory to ROS app generation command+strROSAppDirArgDesc :: String+strROSAppDirArgDesc = "Target directory"++-- | Argument FRET CS to ROS app generation command+strROSAppFRETFileNameArgDesc :: String+strROSAppFRETFileNameArgDesc =+  "File containing FRET Component Specification"++-- | Argument variable list to ROS app generation command+strROSAppVarListArgDesc :: String+strROSAppVarListArgDesc =+  "File containing list of ROS variables to make accessible"++-- | Argument variable database to ROS app generation command+strROSAppVarDBArgDesc :: String+strROSAppVarDBArgDesc =+  "File containing a DB of known ROS variables"++-- | Argument handler list to ROS app generation command+strROSAppHandlerListArgDesc :: String+strROSAppHandlerListArgDesc =+  "File containing list of Copilot handlers used in the specification"
src/CLI/CommandTop.hs view
@@ -91,6 +91,7 @@ import qualified CLI.CommandCStructs2MsgHandlers import qualified CLI.CommandFretComponentSpec2Copilot import qualified CLI.CommandFretReqsDB2Copilot+import qualified CLI.CommandROSApp  -- * Command @@ -105,6 +106,7 @@   | CommandOptsCStructs2MsgHandlers      CLI.CommandCStructs2MsgHandlers.CommandOpts   | CommandOptsFretComponentSpec2Copilot CLI.CommandFretComponentSpec2Copilot.CommandOpts   | CommandOptsFretReqsDB2Copilot        CLI.CommandFretReqsDB2Copilot.CommandOpts+  | CommandOptsROSApp                    CLI.CommandROSApp.CommandOpts  -- * CLI @@ -121,6 +123,7 @@   <> subcommandCFSApp   <> subcommandFretComponentSpec   <> subcommandFretReqs+  <> subcommandROSApp   )  -- | Modifier for the CStruct to Copilot Struct generation subcommand, linking@@ -175,6 +178,15 @@        <$> CLI.CommandFretReqsDB2Copilot.commandOptsParser)     CLI.CommandFretReqsDB2Copilot.commandDesc +-- | Modifier for the ROS app expansion subcommand, linking the subcommand+-- options and description to the command @ros@ at top level.+subcommandROSApp :: Mod CommandFields CommandOpts+subcommandROSApp =+  subcommand+    "ros"+    (CommandOptsROSApp <$> CLI.CommandROSApp.commandOptsParser)+    CLI.CommandROSApp.commandDesc+ -- * Command dispatcher  -- | Command dispatcher that obtains the parameters from the command line and@@ -207,6 +219,8 @@   id <$> CLI.CommandFretComponentSpec2Copilot.command c command (CommandOptsFretReqsDB2Copilot c) =   id <$> CLI.CommandFretReqsDB2Copilot.command c+command (CommandOptsROSApp c) =+  id <$> CLI.CommandROSApp.command c  -- We indicate to HLint that the use of (id <$>) above should not trigger a -- warning. Conceptually, there is a transformation taking place, but no change
src/Main.hs view
@@ -50,6 +50,9 @@ -- * Generate NASA core Flight System (cFS) applications for runtime monitoring -- using Copilot. --+-- * Generate Robot Operating System (ROS) applications for runtime monitoring+-- using Copilot.+-- -- More information can be obtained by calling ogma with the argument @--help@. module Main     ( main )