Package: skydy
Contents:Background|Installation|Running|Contributing|BackgroundWelcome to SkyDy—aDynamics package for Python built by me,ScottKyle.The purpose of this repository is to provide a way to programmatically define an
inter-connected mechnical system (ICMS)—a collection of rigid bodies—to ultimately determine its:coordinate system;forward kinematic maps;kinetic and potential energy;kinetic energy (Riemannian) metric;generalised forces;equations of motion;forced and unforced equilibria.The idea is to have a fully integrated way to define and describe ICMS, and produce useful content. Note, we refer the user toGeometric Control of Mechanical Systems (Bullo & Lewis)for definitions and descriptons used throughout.ICMS are typically "simple" to scribble down on a piece of paper, yet notoriously "difficult" to model correctly. Even with two bodies, the book-keeping and accounting on the rotation matrices alone renders the modelling task cumbersome and error prone. This repository is here to (help) solve that.The goal is to be able to take a schematic drawing from paper, and by methodically using code,
define the ICMS. The output of this effort can be one, or many of the following:A diagram of the ICMS.A latex document (and PDF), deriving equations of motion.A symbolic representation, that can be used a starting point for running simulations.This repository relies on the principle that any system is simply a collection of independent bodies connected, via joints, in different geometric configurations. As such, the mainstays of this repository are the following classes:Body: a collection of particles that has a mass, and some dimensions (length, width and height), and has six degrees of freedom (DOFs).Joint: a common location for two bodies to interact, and a description of how the bodies can move relative to each other. AJointallows motion in certain directions (DOFs) and/or enforces constraints. Thus, aJointdictates the spatial coordinates (or variables) each body will contribute to the ICMS.Connection: defined by an input and outputBody, and aJoint. Since (by construction) the location of the joint is defined in both the input body and output body's coordinate frames, the configuration of the outputBodycan be written in terms of the inputBody. A connection is also where we enforce the constraints of theJoint, which ultimately dictates how the outputBodymoves in the coordinate frame of the inputBody.BodyCoordindate: defines an (x, y, z) triple in the respective body coordinate frame, from its centre of mass. As we connect bodies to one another, we start to translate and rotate these coordinates by the position and rotation matrices (Configuration) of eachBody.MultiBody: a sequence ofConnections. If we are diligent with our definitions of coordinates, bodies and joints, the creation of aMultiBodyis straightforward.Ground: every system needs reference to a global, or fixed coordinate frame. This is defined as theGround. It does not translate. It does not rotate. It is our origin (0, 0, 0). EveryMultiBodyneeds one.For this methodology,all definitions and descriptions are done in a Body's coordinate frame.Installation & UsageInstallationBuild from this repository:Build a local copy of the package (see note):git clone https://github.com/smkyle90/skydy.gitcd skydypip install --upgrade .Using Docker:git clone https://github.com/smkyle90/skydy.gitcd skydymake buildUsing pip andPyPi(see note):pip install skydy.Note: For1.1and2.1, OS level dependencies includepython3-tkandpdflatex.UsageWe encourage the reader to review theexamplesfolder for some basic examples. There are useable.pyfiles in thepythondirectory, as well as interative notebooks innotebooks. The collection of examples are the simplest, yet most common, systems this modelling methodology can be used on, and include:A one-dimensional cart that moves in the x-coordinate.A one-dimensional pendulum that rotates about an axis.A cart-pendulum—a combination of the two systems above.A hovercraft—an object that can move in two-dimensions and rotate.A double pendulum.For step-by-step development, the user is encouraged to run their code in an interactive notebook. This will leverage the power ofSympyand theskydyprocess. The Docker image associated with this repository has Jupyter installed. To enter an interactive session, simply runjupyter notebook --allow-rootfrom the container and copy and paste the address the terminal provides into your browser of choice.DocumentationSkydy documentation can be foundhereon Read The Docs! The docs are aligned with the latest Github release.RunningFor this repository to function as intended, a few tools have been provided to ensure the application can be containerised.MakefileThe content of theMakefileshould only be modified if the standard behaviour is not achieved using the default. Standard commands are as follows:CommandActionImage Tag (local and remote)make runRuns a local imageGit commit's tag, otherwiselatestScriptsThescriptsfolder must maintain the following, which are indirectly run from the Makefile in the root directory. Thebuildscript is customizable per the  application, but it must build a local image of the application. Therunscript  Thruns the container without local screen priviledged. Thedevscript allows the user to use the screen of their local machine.ScriptInputsOutputbuild.shNAME TAGApplication image is created locally, tagged with input argsrun.shNAME TAGApplication image is run locallydev.shNAME TAGApplication image is run locally, with screen priviledsges for plotting and development purposesDeveloping & ContributingThe guidelines for contributing are laid out here. All members of the team have write access.TODOWhat I want to get done:Documentation (Completed June 13, 2021. Docstrings added and infrastructure for Read The Docs & Sphinx autodocs. Release v0.0.2.)Decent Documentation (Release v0.0.3.)Thorough DocumentationPrettier Latex printingAdd mass data to a Body for MassMatrix and InertiaMatrix objectsKinematically constrained objectsTranslational and rotational springs and dampersFasterForward KinemticsDig intosympy.physics.mechanicsand their Lagrangian capabiltiesRotating forcesSimulationsSystems analysis, including:Stability analysis (Release v0.0.3)Controllability (both Linear and Nonlinear) (Release v0.0.3)Control DesignDecrease the size of the Docker imageAdd an image to Docker hubDevelopment EnvironmentInstallDockerfor creating a nice virtual container to run in.SeeRunning.TestingNo untested code will be allowed to merge onto Master. A 90% coverage and test passing report is required for all Master PRs.Using PyTestThis library uses pytest for testing. To run the full test suite use the commandpytest tests/ --cov=skydy --cov-report=html.Take note of the marks inpytest.ini. To run specific tests, say only the "rigidbody" module, runpytest tests/ --cov=skydy --cov-report=html -m rigidbody.One can use the args-vv -sto get detailed print outs during testing, i.e.,pytest tests/ --cov=skydy --cov-report=html -vv -sCode StyleCode style is handled and enforced withBlack,Flake8and some additional stylers and formatters. A pre-commit hook is provided with this repository so that all code is automatically kept consistent. If there are any issues with formatting, please submit a formal PR to this repository.Docstrings will be formatted according to the Google docstring formatting, and as best as possible, styled as per thePEP 8style guide.