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

Unable to find the equivalent of rospy.get_time() #34

Open
Tahaan opened this issue Jun 3, 2021 · 9 comments
Open

Unable to find the equivalent of rospy.get_time() #34

Tahaan opened this issue Jun 3, 2021 · 9 comments

Comments

@Tahaan
Copy link

Tahaan commented Jun 3, 2021

Is there a way to query the time?

I'm very new to anything ROS and, for that matter, a total noob on all of this.

I'm trying to send a Twist command form an Android app to a topic like this:

      nodeHandle =
          await dartros.initNode('test_node', <String>[], rosMasterUri: MASTER_URI, anonymize: true);

      final twist = Twist(linear: linear, angular: angular);
      final pub = nodeHandle!.advertise('/turtle1/cmd_vel', Twist(),
            queueSize: 10, throttleMs: 20);
      pub.publish(twist);

Since "nothing appears to happen" I'm trying to debug it and was hoping for a get_time or something that can tell me that it is really connected.

Note that I have found no documentation on what to pass to the args parameter of the initNode... So perhaps that is where the problem lies?

@TimWhiting
Copy link
Collaborator

try

final time = Time.now();

@Tahaan
Copy link
Author

Tahaan commented Jun 3, 2021

That would just give the local time on the device.

Or am I missing something?

@TimWhiting
Copy link
Collaborator

No that is the Ros subscription to the time. DateTime.now() is the computer / dart local time.

@TimWhiting
Copy link
Collaborator

@Tahaan
Copy link
Author

Tahaan commented Jun 3, 2021

OK, thank you. It works as far as I can tell. Hard to verify but by changing my local time a couple of seconds, I managed to get it to give me a different result.

Which leaves me still not knowing where my messages gets lost.

@TimWhiting
Copy link
Collaborator

Are you on the same network? Are other things working? Is the ROS_MASTER_URI set properly as well as the ROS_IP on the phone. Just a few things you could check. Typically if there are problems with publishing and not subscribing I would check the ROS_IP

@Tahaan
Copy link
Author

Tahaan commented Jun 3, 2021

I'm not on the same network, The Ros server is 1500 Kms away in another city. I have port forwarding over SSH to connect to the Ros system.

My MASTER_URI points to the host:port on my local lan which forwards to the ros system.

When I connect to it via a browser, I get a message which gives an error which tells me that it is working.

Error response
Error code: 501

Message: Unsupported method ('GET').

Error code explanation: HTTPStatus.NOT_IMPLEMENTED - Server does not support this operation.

If I close the SSH tunnel then in stead of the above I get a connection refused

@TimWhiting
Copy link
Collaborator

TimWhiting commented Jun 3, 2021

How does the Ros server initiate connections with you then? You would need port forwarding from the server back to your phone.

ROS has servers on both devices and each connects to each other, (i.e. this package spins up a server that talks to the master server at ROS_MASTER_URI) and they have to know each other's IP addresses and be able to initiate connections both ways. That way a process that spins up can create outbound connections and listen to inbound connections to do both publishing and subscribing. If the server is told to connect to the IP address of your device to connect to a certain publisher, it needs to be able to access your phone's IP address. Can you try pinging from the server to your phone. The phone's IP address is likely to change and cause problems that way unless you give it a static IP on a VPN that is accessible to the server.

@Tahaan
Copy link
Author

Tahaan commented Jun 20, 2021

Somehow I missed your response until now. I will set up revese port forwarding - I did not know it was needed.

I will report back once I have been able to test.

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