Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce SMURFA-format #93

Merged
merged 29 commits into from
Feb 10, 2021
Merged

Introduce SMURFA-format #93

merged 29 commits into from
Feb 10, 2021

Conversation

hwiedPro
Copy link
Contributor

@hwiedPro hwiedPro commented Jan 17, 2019

Now we can define robot assemblies similar to xacro.
This will solve issue #78

Changes

The following sections define the changes made.

Changes in Key parsing

We use new keys and define old ones new.

  • parent defines the frame in which position and rotationare given. So the FTS300 in the example below is rotated 90 degrees around the y-axis of the frame of the ur5 entity's ee_link node. parent's default value is "world"
  • anchor defines to which node we create a fixed link to mount the next part of our assembly. parent's default value is "none"

The node for parent or anchor is always given in the way $ENTITY_NAME::$NODE_NAME.
There are a few special keywords that can be used as well:

  • world: the world node/orign
  • none (only for anchor): no fixed joint is created
  • parent (only for anchor): a fixed joint to the node given as parent is created

SMURFA Format

Therefore we can define a *.smurfa file with the following exemplary content:

smurfa:
  - name: ur5
    file: ur5/smurf/ur5.smurf
    root: true
    position: [0,0,0]
    rotation: [1,0,0,0]
  - name: fts300
    file: robotiq_fts300/smurf/robotiq_fts300.smurf
    parent: "ur5::ee_link"
    anchor: parent
    rotation: [0,90,0]
  - name: gripper
    file: robotiq_2f-140/smurf/gripper_2f_140.smurf
    parent: "fts300::fts_toolside"
    anchor: parent
    position: [0,0,0]
    data_package: 0

In this example we have an ur5 robot, which is defined as the root of our assembly, by setting root: True.

It is possible to define multiple roots in one file, but they will belong to the same assembly. The placement of the assembly via the position and rotation parameters in the higher-level scene will only be applied for root entities. Also make sure to define all non-root objects relative to a root using parent.

The data_package entry defines how much data is sent to the DataBroker by the anchor joint. (0: none, 1: reduced, else or not given: full).

SMURFS Format

Old SMURFS files using the anchor can be used in the same way as before. SMURFS files using parent to define a fixation have to be adapted.

We can include SMURFA files in a scene (see below). In this case - just as before when including a robot - you can define the position and rotation. Both are applied on the whole assembly, giving you the ability to place the whole assembly with those two parameters. Additionally you should give an unique name for your assembly.
SMURFS allows the usage of parent and anchor like in SMURFA, too, but the entities are not linked in an assembly.

smurfs:
  - file: test.smurfa
    type: smurfa
    position: [1,1,1]
    rotation: 90
    anchor: world
    name: assembly
    data_package: 1

ToDo

  • [Done] position and rotation (Exception: what(): Item is of wrong type.)
    Currently the application of the overall placement of the assembly is only possible if the root nodes position and rotation are given in the way:

    position: [$X, $Y $Z]
    rotation: [$W, $X, $Y, $Z]
    

    This is a problem while overwriting parts of the underlying configmap.
    Done -> f6f0c09

  • [Done] zipped version of this format (ZSMURFA)
    Currently the entity_factory for ZSMURFA is not defined.
    -> Done with commit 1dbf3a4

  • [Done] Sort all loaded entities before creating them, so that one's entities dependencies are loaded beforehand.
    -> Done with commit 16a33b1

'parent' defines frame of 'position' & 'rotation'
'anchor' defines second fixed joint node
For both parameters the nodes are given in the way $ENTITY::$NODE
You can set the following special values for anchor:
 - 'parent' to create a fixed joint to the parent node
 - 'none' to not fix this entity
 - 'world' to create a fixed joint to the world
Parent accepts 'world', too, which is it's default value.
@hwiedPro hwiedPro changed the title (WIP) introduce SMURFA-format Introduce SMURFA-format Jan 18, 2019
@hwiedPro hwiedPro requested a review from malter January 18, 2019 09:10
@hwiedPro
Copy link
Contributor Author

@malter: Please review commit f6f0c09. Is there a way to solve this more elegant with configmap methods?

@hwiedPro hwiedPro changed the title Introduce SMURFA-format (WIP) Introduce SMURFA-format Jan 28, 2019
@hwiedPro
Copy link
Contributor Author

Set to WIP
--> merging with smurfs

@hwiedPro
Copy link
Contributor Author

Loading another SMURFS into a first SMURFS now accepts parent and anchor definitions, too.
All entities in the second SMURFS, which are parented to the world, are transformed by the position and rotation given in the SMURFS include entry.
For SMURFS includes, anchor and parent entries from the include definition are only applied for entities parented to the world.

If a SMURFA is included the superior anchor/parent parameter is only applied to the entities defined as root.

@hwiedPro hwiedPro changed the title (WIP) Introduce SMURFA-format Introduce SMURFA-format Jan 30, 2019
@hwiedPro
Copy link
Contributor Author

In testing...

@hwiedPro
Copy link
Contributor Author

hwiedPro commented Feb 8, 2019

Corrected the smurfloader in such way that the entities are loaded in the order the smurfs files have been written.

It would be nice if it would load correctly independently from the order... --> To Do

@hwiedPro hwiedPro changed the base branch from develop to master May 20, 2019 13:55
@hwiedPro
Copy link
Contributor Author

A further enhancement might be a field in a smurfa entry to define the type of the anchor joint. This also requires joint information, like limits and axis. This will be postponed until it is needed.

@hwiedPro hwiedPro changed the base branch from master to develop January 22, 2020 15:23
@@ -115,6 +115,23 @@ namespace mars {
// set the next free id
jointS->index = next_joint_id;
next_joint_id++;
if (jointS->config.hasKey("desired_id"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the desired_id really useful? The whole application should work too, even if the id is not free. So, why is the desired_id required? In most cases where new id's are generated, the desired ones are not free anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives the possiblity to separate the ids and give the model a clearer structure, if not needed it can just be skipped.

@malter malter merged commit 4f405f4 into develop Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants