-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
501 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +0,0 @@ | ||
# A large chunk of the code in the `lisdf.parsing` modules and submodules were | ||
# modified from https://github.com/ros/urdf_parser_py to support recursion. | ||
|
||
|
||
from .all import load_all # noqa: F401 | ||
from .mjcf import load_mjcf # noqa: F401 | ||
from .pddl_j import load_pddl, load_pddl_string # noqa: F401 | ||
from .sdf_j import load_sdf, load_sdf_string # noqa: F401 | ||
from .urdf_j import load_urdf, load_urdf_string # noqa: F401 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(define | ||
(domain lispddl-builtins) | ||
(:types | ||
qr::object | ||
qr::value | ||
qr::link - qr::object | ||
qr::joint - qr::object | ||
qr::chain - qr::object | ||
qr::frame - qr::object | ||
qr::body - qr::object | ||
qr::joint-conf - qr::value | ||
qr::chain-conf - qr::value | ||
qr::color - qr::value ; (r, g, b, a) | ||
|
||
qr::pose - qr::value ; (x, y, z, roll, pitch, yaw) | ||
) | ||
|
||
(:object-types | ||
; a built-in "world-type". Used to create the world frame. | ||
(qr::world-type "") | ||
(qrgeom::box-type "") | ||
) | ||
|
||
(:predicates | ||
; predicates for downstream parsers that do not support typing. | ||
(is-qr-link ?link) | ||
(is-qr-joint ?joint) | ||
(is-qr-chain ?chain) | ||
(is-qr-frame ?frame) | ||
(is-qr-body ?body) | ||
(is-qr-joint-conf ?pose) | ||
(is-qr-chain-conf ?pose) | ||
(is-qr-body-pose ?pose) | ||
|
||
; ?body: a free body | ||
; ?pose: (x, y, z, roll, pitch, yaw) | ||
(body-pose ?body - qr::body ?pose - qr::pose) | ||
|
||
; ?body: a body | ||
; ?scale: a single valuekj | ||
(body-scale ?body - qr::body ?scale - qr::value) | ||
|
||
; ?parent-frame: an object::frame_name of the parent | ||
; ?child-frame: an object::frame_name of the child | ||
; ?X_PC: the pose of the child relative to the parent, in (x, y, z, roll, pitch, yaw) | ||
(weld ?parent-frame - qr::frame ?child-frame - qr::frame ?X_PC - qr::pose) | ||
|
||
; ?x: a joint of a robot | ||
; ?c: a value | ||
(joint-conf ?x - qr::joint ?c - qr::joint-conf) | ||
|
||
; ?x: a kinematic chain | ||
; ?c: a list of values | ||
(chain-conf ?x - qr::chain ?c - qr::chain-conf) | ||
|
||
; ?x: a body | ||
; ?y: a link of the robot | ||
; ?g: a grasp, specified as a transform from ?y to ?x, in (x, y, z, roll, pitch, yaw) | ||
(holding ?x - qr::body ?y - qr::link ?g - qr::pose) | ||
|
||
; ?x: the name of the body | ||
; ?size: the size of the box, as a tuple of (length_x, length_y, length_z) | ||
(qrgeom::box-shape ?x - qr::body ?size - qr::value) | ||
|
||
; ?x: the name of the body | ||
; ?color: the color of the box, as a tuple of (r, g, b, a) | ||
(qrgeom::box-color ?x - qr::body ?color - qr::color) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
start: definition | expr | ||
|
||
definition: "(" "define" definition_decl supp_definitions ")" | ||
|
||
definition_decl: "(" definition_type definition_name ")" | ||
?definition_type: VARNAME | ||
?definition_name: VARNAME | ||
|
||
supp_definitions: supp_definition* supp_definition | ||
?supp_definition: domain_definition | ||
| requirements_definition | ||
| types_definition | ||
| object_types_definition | ||
| constants_definition | ||
| predicates_definition | ||
| objects_definition | ||
| init_definition | ||
| goal_definition | ||
|
||
// domain | ||
domain_definition: "(" ":" "domain" domain_name ")" | ||
domain_name: VARNAME | ||
|
||
// requirements | ||
requirements_definition: "(" ":" "requirements" requirement_name* ")" | ||
requirement_name: ":" VARNAME | ||
|
||
// types | ||
types_definition: "(" ":" "types" type_definition* ")" | ||
type_definition: object_type_name+ | ||
| object_type_name+ "-" parent_type_name | ||
parent_type_name: object_type_name | ||
|
||
// types | ||
object_types_definition: "(" ":" "object-types" object_type_definition* ")" | ||
object_type_definition: "(" object_type_name string ")" | ||
|
||
// constants | ||
constants_definition: "(" ":" "constants" constant_definition* ")" | ||
constant_definition: allconstant | ||
|
||
// predicates | ||
predicates_definition: "(" ":" "predicates" predicate_definition* ")" | ||
predicate_definition: "(" predicate_name allvariable* ")" | ||
?predicate_name: function_name | method_name | ||
|
||
// objects | ||
objects_definition: "(" ":" "objects" object_definition* ")" | ||
object_definition: allconstant | ||
|
||
// init | ||
init_definition: "(" ":" "init" init_definition_item* ")" | ||
init_definition_item: function_call | ||
|
||
// goal | ||
goal_definition: "(" ":" "goal" function_call ")" | ||
|
||
// variable name | ||
%import common.LETTER | ||
%import common.DIGIT | ||
VARNAME: LETTER ("_"|"-"|LETTER|DIGIT)* | ||
CONSTNAME: (LETTER|"@"|"_") ("_"|"-"|":"|"#"|LETTER|DIGIT)* | ||
|
||
// variables and constants | ||
VARIABLE: "?" VARNAME | ||
variable: VARIABLE | ||
CONSTANT: CONSTNAME | ||
constant: CONSTANT | ||
typedvariable: variable "-" object_type_name | ||
typedconstant: constant "-" object_type_name | ||
|
||
?allconstant: constant | typedconstant | ||
?allvariable: variable | typedvariable | ||
|
||
// type name | ||
type_name: CONSTANT | ||
object_type_name: type_name | ||
|
||
// literal types | ||
?literal: bool | number | string | list | ||
TRUE: "true" | ||
FALSE: "false" | ||
bool: TRUE | FALSE | ||
|
||
// numbers | ||
INT: DIGIT+ | ||
SIGNED_INT: ["+"|"-"] INT | ||
// DECIMAL: INT "." INT? | "." INT | ||
DECIMAL: INT "." INT? | "." INT | ||
|
||
// float = /-?\d+(\.\d+)?([eE][+-]?\d+)?/ | ||
_EXP: ("e"|"E") SIGNED_INT | ||
FLOAT: INT _EXP | DECIMAL _EXP? | ||
SIGNED_FLOAT: ["+"|"-"] FLOAT | ||
|
||
NUMBER: FLOAT | INT | ||
SIGNED_NUMBER: ["+"|"-"] NUMBER | ||
|
||
int: INT | SIGNED_INT | ||
float: NUMBER | SIGNED_NUMBER | ||
?number: float | ||
|
||
%import common.ESCAPED_STRING | ||
string: ESCAPED_STRING | ||
list: "[" "]" | ||
| "[" literal ("," literal)* "]" | ||
| "(" literal ("," literal)* ")" | ||
|
||
named_literal: CONSTNAME "=" literal | ||
|
||
// expression | ||
?expr_function_call: function_call | quantified_function_call | ||
?expr: variable | constant | literal | named_literal | expr_function_call | ||
|
||
function_call: "(" (function_name|method_name) expr* ")" | ||
function_name: VARNAME | ||
method_name: VARNAME SCOPE_SEP VARNAME | ||
SCOPE_SEP: "::" | ||
|
||
EXISTS: "exists" | ||
FORALL: "forall" | ||
IOTA: "iota" | ||
?quantifier: EXISTS | FORALL | IOTA | ||
quantified_function_call: "(" quantifier "(" typedvariable ")" expr ")" | ||
|
||
%import common.WS | ||
%ignore WS | ||
|
||
%import common.NEWLINE | ||
COMMENT: ";" /(.)+/ NEWLINE | ||
| "#" /(.)+/ NEWLINE | ||
%ignore COMMENT |
Oops, something went wrong.