Skip to content

[RSDK-14161] Implement support for streaming#223

Open
Andrew C. Morrow (acmorrow) wants to merge 22 commits into
viam-modules:mainfrom
acmorrow:RSDK-14161-streaming-mtjp
Open

[RSDK-14161] Implement support for streaming#223
Andrew C. Morrow (acmorrow) wants to merge 22 commits into
viam-modules:mainfrom
acmorrow:RSDK-14161-streaming-mtjp

Conversation

@acmorrow

Copy link
Copy Markdown
Contributor

No description provided.

@JohnN193 JohnN193 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not really sure how users/sanding will use the uuid. streaming stuff looks good to me though

root_["realtime_samples"] = Json::Value(Json::arrayValue);

output_path_ = telemetry_path / (timestamp + "_" + resource_name + "_realtime_trajectory.json");
output_path_ = telemetry_path / (move_id_str + "_" + resource_name + "_realtime_trajectory.json");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

will this make it harder to pair moves with sanding data?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't. Before, the timestamp was being used as the unique id, basically. It got tacked onto files and logs, but it was weird, because you would see the logs advancing with real time, but the logged "unix time" was the "correlation id". Now you just get a UUID for each move: way easier to correlate, and isn't confusing in the logs where there are two "times".

That said, we should definitely alert them to the change!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked in with Brad Grigsby (@bgrigsby8) and he was OK with this change.

Comment on lines +74 to +78
// from k_open, first points pending: send STREAM_START, go to k_streaming.
// from k_open, on close: go to k_buffered.
// from k_streaming, on close: go to k_draining.
// from k_buffered: send START, drain, and END in one tick, go to k_ended.
// from k_draining, once drained: send STREAM_END, go to k_ended.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

having trouble finding it, but just to confirm does move_through_joint_positions just go through the k_buffered branch? or do we call TRAJECTORY_START somewhere else for that now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's exactly right: move_through_joint_positions will call start_move_request with trajectory_samples, which will find the matching move_request constructor. That constructor will create a sample_stream that begins life in k_buffered, with all the points already there. Then the state machine knows that for k_buffered, there is no need to use the STREAM stuff and falls back to plain old TRAJECTORY_START. A little convoluted, but has the net effect that both kinds of moves arrive in the state machine the same way, and we only stream when streaming is needed. A one-shot move becomes k_buffered and goes the old way, as does a, say, degenerate stream with only one batch of points that all arrive before the worker thread tick.

Comment thread src/viam/ur/module/ur_arm_state.hpp Outdated
Comment thread src/viam/ur/module/ur_arm_state.hpp Outdated
Comment on lines +74 to +78
// from k_open, first points pending: send STREAM_START, go to k_streaming.
// from k_open, on close: go to k_buffered.
// from k_streaming, on close: go to k_draining.
// from k_buffered: send START, drain, and END in one tick, go to k_ended.
// from k_draining, once drained: send STREAM_END, go to k_ended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's exactly right: move_through_joint_positions will call start_move_request with trajectory_samples, which will find the matching move_request constructor. That constructor will create a sample_stream that begins life in k_buffered, with all the points already there. Then the state machine knows that for k_buffered, there is no need to use the STREAM stuff and falls back to plain old TRAJECTORY_START. A little convoluted, but has the net effect that both kinds of moves arrive in the state machine the same way, and we only stream when streaming is needed. A one-shot move becomes k_buffered and goes the old way, as does a, say, degenerate stream with only one batch of points that all arrive before the worker thread tick.

root_["realtime_samples"] = Json::Value(Json::arrayValue);

output_path_ = telemetry_path / (timestamp + "_" + resource_name + "_realtime_trajectory.json");
output_path_ = telemetry_path / (move_id_str + "_" + resource_name + "_realtime_trajectory.json");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't. Before, the timestamp was being used as the unique id, basically. It got tacked onto files and logs, but it was weird, because you would see the logs advancing with real time, but the logged "unix time" was the "correlation id". Now you just get a UUID for each move: way easier to correlate, and isn't confusing in the logs where there are two "times".

That said, we should definitely alert them to the change!

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

Successfully merging this pull request may close these issues.

2 participants