-
Notifications
You must be signed in to change notification settings - Fork 11
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
Issues in initNode #42
Comments
Currently initNode is not intended to be run more than once. It only initializes the first time, then it returns a singleton. This is an artifact of how rosnodejs did it, but I'd like to be able to init / shutdown multiple nodes so I can connect to different rosmasteruris which I think is what you are trying to do as well. Anyways, it's on the roadmap, but I don't know exactly when I will have the time to get it done. Glad to accept any contributions if you want to figure it out and submit a PR. |
Can you explain your use case some more? Why are you re-running initNode instead of running it once in main? Do I need to be catching more failures in connections? A minimally reproducable sample would be helpful. I'm working on what I think to be a fix, but I'm not sure if your use case is the same as mine. |
I have built a simple universal robot controller app, and probably there will be a button for connecting to robots using ROS. The interface will provide a button for connecting to ROS, and probably after a successful connection, the button may able to disconnect to ROS, and sometime changing the ip to connect to another robot using the same app. In connection failure, after the first call in initNode, the button was still there, and it is easy for the users to connect by pressing the button again, so initNode will be called twice, and more. I think the current failures catching are good enough. For reproducing the samples of reconnection, probably I have reimplemented a similar project with the following links. It used another libraries of dart implementation ros, and I am using your library to reimplement that, for a more advance controller. I hope the information is helpful for advancing the library. |
Hi, after using the library for a while, it works pretty fine.
However, there is a minor problem with initNode.
Sometimes, exception will raise when there is failure in connection which is normal.
(For example, connection refused, no route found, which caused by Linux or Router Routing Table respectively)
However, the issue is that with re-establishing the connection (Or re running initNode), the failure will not be raised. Everythings is going to be looking good, but of course, the connection between a flutter app using the library and the computer running ROS melodic is still not success.
To rebuild the issue, the sample code of a button click to establish connection between ROS will be like
void connectToROS(BuildContext context) async {
try
{
node = await initNode('App', [], rosMasterUri: 'http://192.168.1.5/').timeout(Duration(seconds: 10));
/*
And here will be some topic subscription and service advertisement
*/
} catch (e) {
print(e.toString());
}
}
To be simple, error will only be raised for the first time, not for the trial later.
I guess if there is any missing in the catch statement, or it is a bug for initNode. I appreciate if any helps can be provided here.
The text was updated successfully, but these errors were encountered: