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

Add connection timeout and respawn options #105

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

QuentinTorg
Copy link
Collaborator

The camera_timeout_s will cause the multisense node to shut down if it cannot communicate with the camera for camera_timeout_s seconds. Setting this value <=0 will disable the timeout check

The respawn being true means the multisense launch file will attempt to re-launch the node if it is shut down

Used together these two options can be used to automatically re-connect to a camera after it is disconnected/reconnected or power cycled

if (Status_Ok != status_result) {

if (ros::Time::now() - last_warning > warn_delay) {
ROS_WARN("multisense_ros: lost connection with camera");
Copy link
Contributor

Choose a reason for hiding this comment

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

This warning is fairly aggressive. Consider softening the language.

}

if (timeout > ros::Duration{0} && ros::Time::now() - last_status > timeout) {
ROS_ERROR("multisense_ros: shutting down due to connection timeout");
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider changing this to something like "reinitializing connection with the MultiSense"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure what less harsh comment would be applicable. During shutdown, we only respawn if the respawn argument was also passed, so I don't quite want to say that here. After this comment, we also exit with an error code, so it seems acceptable to be harsh

ros::spinOnce();

system::StatusMessage statusMessage;
const auto status_result = d->getDeviceStatus(statusMessage);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only get updated at 1Hz under the hood.

const auto status_result = d->getDeviceStatus(statusMessage);
if (Status_Ok != status_result) {

if (ros::Time::now() - last_warning > warn_delay) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this might be too chatty when a single status message is dropped

@QuentinTorg
Copy link
Collaborator Author

@mattalvarado I have updated so it does not print a warning until the status message has been missing for a full second, and only print at 1Hz to match the status message publish rate. The comment in the launch file for the camera_timeout setting also indicates times of 3s or more should be preferred

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