Skip to content

A language proposal for a domain-specific language for Gazebo models, units, and simulation scripting., as an alternative to xml

Notifications You must be signed in to change notification settings

kwikius/gzScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 

Repository files navigation

gzScript

A domain-specific language for Gazebo simulation scripting.


Overview

gzScript is an experimental DSL (domain-specific language) designed to make working with Gazebo easier and more intuitive. gzScript aims to provide:

  • Strongly typed quantities and units (SI-first, safe conversions).
  • A clean syntax for describing models, poses, joints, and animations.
  • An approachable scripting language for simulation experiments.
  • A foundation for higher-level workflows (model design, control, testing).

Why?

Gazebo is powerful, but SDF and plugin code can be verbose and error-prone. gzScript explores whether we can design a friendlier layer on top, without losing rigor.

Goals:

  • Reduce boilerplate.
  • Prevent unit errors.
  • Enable “sketching” of simulation ideas quickly.
  • Stay interoperable with Gazebo ecosystem.

Physical quantities and units

First things first. To model physical systems legibly requires strongly typed physical quantities. Work has been ongoing, notably in C++, for example in pqs, quan and mp-units, to provide a semantic for representing physical quanties in an expressive way.
gzScript provides an opportunity to enshrine physical quantities in the language itself. C++ has the notion of a user defined literal. It is a nice idea, but very limited in practise. in c++ the literal is effectively in the global namespace and units can't be composed due to C++ syntax. in gzScript, units live in their own exclusive semantic space in which the rules of units only can be applied. The unit namespace is enterd and exited using the colon':' as follows :



// Quantities lvalues are constant by default
v = 5:m/s:;
t = 2:s:;
d = v * t;      // 10:m:

// Refined quantities
h:height: = 1.2:m:;
w:width:  = 0.3:m:;

// Declare a unit alias
mph = :mi/h:;

// Angle handling
var theta = 180:deg:;  // theta can be modified
phi   = 3.14:rad:;

theta = phi; // angle conversions

Features (planned)

  • Core principles for units & quantities
  • Parser / grammar draft (Bison/Flex)
  • Interpreter / compiler backend
  • Gazebo integration (generate SDF / send commands)
  • Example models and control scripts

Status

Work in progress. This project is currently in early design stages. Contributions, ideas, and discussions are welcome.


Related Work


License

TBD (MIT or Apache-2.0 recommended).


About

A language proposal for a domain-specific language for Gazebo models, units, and simulation scripting., as an alternative to xml

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published