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

robot_frames should initially publish each transformation once #1

Open
mintar opened this issue Dec 2, 2015 · 2 comments
Open

robot_frames should initially publish each transformation once #1

mintar opened this issue Dec 2, 2015 · 2 comments

Comments

@mintar
Copy link

mintar commented Dec 2, 2015

IMO, robot_frames should initially publish each transformation once right when starting up, with a time stamp that's long in the past but non-zero (e.g., 1). If we connect the output of robot_frames to transformer, this would cause transformer to register all the required streams with its internal stream aligner. That way, if robot_frames doesn't get some joint states on its input port (e.g., because the component that provides the joint states is not running yet), transformer would properly drop the data samples during that period.

Currently, transformer fires its callback, but inside the callback, the registered transformations fail.

See rock-core/drivers-transformer#11.

BTW: Is it legal to write stuff to ports inside the startHook? If not, we need to find a way to trigger the updateHook once after startup.

@mintar
Copy link
Author

mintar commented Dec 2, 2015

BTW, even with this fix, stuff is getting ugly fast, because we have to be very careful with the order of initialization. Here is a small example for a task (urdf_filter) that uses a transformer internally and receives data from robot_frames::Task:

    # first configure robot_frames, so that the output ports are created
    robot_frames.configure
    urdf_filter.configure

    # next, connect the ports
    robot_frames.each_output_port do |port|
      if port.type == urdf_filter.input_tf.type
        port.connect_to urdf_filter.input_tf, type: :buffer, size: 10000
      end
    end

    # we have to start this first, so that urdf_filter processes
    # the messages generated by robot_frames, right?
    urdf_filter.start   

    # this will publish the initial set of messages
    robot_frames.start

If we switch any of these steps around, things will stop working, correct?

@doudou
Copy link

doudou commented Dec 7, 2015

If we switch any of these steps around, things will stop working, correct?

Correct. The problem here is that the way we use the RTT dataflow assumes that it is used to transmit dynamic data.

One way to mitigate this is to turn keepLastWrittenValue on the robot_frames output port (this has to be done in C++, not supported by orogen AFAIK). You can then use the init: true flag in the connection policy when connecting the ports, which ensures that the last written value is used to initialize the connection. I am however not sure that it works on clear() (i.e. when a task starts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants