{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE DuplicateRecordFields #-}

module Walker.Pkg where

import           Control.Monad.Reader (runReader)
import           SCAD
import           SRDF.Xml             (writeSRDFXML)
import           URDF.Xml             (writeURDFXML)
import		 Data.List
import           Walker
import           Walker.SCAD
import           Walker.SRDF
import           Walker.URDF



generateWalkerPackage :: SimpleWalker -> PackageConfig -> IO ()
generateWalkerPackage w pc = do
    let ew = runReader (extendWalker w) pc
    mapM_ (uncurry renderSCAD) $ getSCADFiles ew
    writeURDFXML (getURDF ew) (pkg_dir pc ++ "/src/koke.urdf")
    writeSRDFXML (getSRDF ew) (pkg_dir pc ++ "/src/koke.srdf")
    renderWalkerStl ew
