Transform Network

Ark does not provide any custom or officially supported transform network library.

However, there are Ark wrappers for the ROS tf2 library provided that allow for easy integration into an Ark pipeline and GUI.

tf2 Publisher/Subscribers

The ark::TransformPublisher can be used to publish transform data to the pipeline.

Initialize the publisher in your stage initialize function:

void MyStage::initialize(ark::pipeline::StageInterface &interface)
{
    ...
    transform_publisher_->initialize(interace);
    ...
}

Publish transforms from a stage callbacks:

void MyStage::callback()
{
    ...
    TransformMessage3dStamped transform;
    transform_publisher_->push_transform(std::move(transform));
    ...
}

The ark::TransformNetworkSubscriber can be used to subscribe to transform data from the pipeline and provides an interface to lookup transforms.

Initialize the publisher in your stage initialize function:

void MyStage::initialize(ark::pipeline::StageInterface &interface)
{
    ...
    transform_subscriber_->initialize(interace);
    ...
}

Lookup transforms from a stage callback:

void MyStage::callback()
{
    ...
    if (auto transform = transform_subscriber_->get_transform("dst", "src", timestamp))
    {
        ...
    }
    ...
}

Simulation Repeatability

In ROS, the default way to use the transform network is to create a listener that processes incoming transforms on a background thread. In ark we do not allow that since it breaks repeatability during simulation. The listener processes incoming transforms through a normal stage callback. The implications of this are blocking wait for transform calls.

GUI

The GUI provides support for utilizing a transform network to draw ark::gui::RendererLayers that have a frame_id set. See GUI (C++) for more information.

There is a tf2 based implementation ark::gui::ArkTransformProvider of the ark::gui::AbstractTransformProvider provided that can be used with the GUI. This provider assumes you are using the above tf2 wrappers in your pipeline.

If you are using a custom transform network implementation you can implement the same interface to allow the GUI to use your custom version.


For more information about how the transform library works under the hood we recommend referring to the original ROS tf2.