-
Notifications
You must be signed in to change notification settings - Fork 165
ROSjava and android ROS commands #254
Comments
Hi @dkati, Personally, I never did something like sending a |
exactly.i want to list the topics of the ros PC i am connected to.... my app allows to subscribe to custom topic names.so if the user is away from PC ,he has to know what topics trully exist to ros master.so he have to somehow see the |
I'd take a look around here: https://github.com/rosjava/rosjava_core/blob/kinetic/rosjava/src/main/java/org/ros/master/client/MasterStateClient.java Unfortunately, it seems that this operation in particular hasn't been implemented: https://github.com/rosjava/rosjava_core/blob/kinetic/rosjava/src/main/java/org/ros/master/client/MasterStateClient.java#L84. I'm not 100% sure, but at first sight it seems that is what you are looking for. As far as I know rostopic is implemented in Python, so you can't use that code on Android. If you really need this feature, I'd suggest you to try to implement that operation. If you send a PR with that fix we can make a new release to the maven repo. I offer myself to review and test this if you choose to go that way. |
thats seems really DEEP for me mister :P ok..thanks for your time!!thanks for all! |
haha yeah, it looks a bit complex at first sight, but perhaps it's not that terrible. Probably all the functionality needed to implement this is somewhere around rosjava, it's a matter of putting the pieces together. |
For anyone venturing into this, the python implementation is in https://github.com/ros/ros_comm/blob/lunar-devel/tools/rostopic/src/rostopic/__init__.py , and |
can u give me more instruction mister :) ? |
Not really : I haven't ever used it, I just have the source code checked out in case I ever needed to. |
Bit of googling found
|
…ecutor ListenerGroup to prevent leak in android when activities are destroyed. Added ability to remove listener from ListenerGroup to fix android_core issue rosjava#254.
Any news about the functionality of rostopic in java? If it is not implemented yet, maybe I can do it. Can sombody can give me some hints? |
Hi @orat, Note that there's also this post on ROS discourse; someone already made an app with this, and it's open source: https://github.com/joostvanstuijvenberg/IntROSpect (it's not using If you ask me, I would try to implement it as part of Rosjava; it would be nice to add something like this to |
Very thanks for your reply and your helpful hints. I have checked the IntROSpect code. It looks very promising to learn how to get the topics information. I agree with you that it would be great to have comparable functionality in rosjava. But why not to implement in https://github.com/rosjava/rosjava_core/blob/kinetic/rosjava/src/main/java/org/ros/master/client/MasterStateClient.java#L84 , in rosjava_core? |
Yes, that would work as well. On second thought, perhaps a good idea would be to mimic ROS CLI tools: https://github.com/ros/ros_comm/blob/melodic-devel/tools/rostopic/src/rostopic/__init__.py#L1154-L1176. Just as an example, |
ok, I will think about to additionally implement a version corresponding to ROS CLI tools. At the moment i have simply implemented the missing method in org.ros.master.client.MasterStateClient: public List getPublishedTopics(String subgraph) { In the original code there is the comment from "keith". Do you know what it means? |
Why is the argument "caller" of the medhods of the class org.ros.master.client.MasterStateClient of type Node and not String. In the current implementation only a name as a String is used (caller.getName()? If the the argument "Node caller" make sense, what is the node I should use? |
Sorry, I'm out of context here.
I honestly don't know either, but my first guess would be that the node names are actually not just any type of string, but graph names with certain constraints. While a string would do, I think it's a matter of being consistent. I'd look somewhere else where |
Thanks for your answer. Yes your are right, GraphNode and not String is used and makes sense for me. I looks a bit strange for me not use GraphNode directly (encapsulated into Node). At the moment this is not important. I implemented the getPublishedTopics() as described in this thread and run into further problems. A null pointer exception is thrown, which has its origin in the class org.ros.internal.response.TopicListResultFactory. I have asked the author of the class but he can not help me. Anybody else? At this point I have the feeling that it cauld be too difficult to complete the code and fix the issues. Maybe the author of the non-rosjava INTRosSpec code runs into the same problems and has descided to implement the functionality without the usage of rosjava. |
I'm very sorry; I'm not into those details right now. I've seen MD5 checksums somewhere else in the code; if I was trying to implement this I'd try to look somewhere else the way they are used and what they are used for. Sounds like you need the name and the checksum of the topics you are listing, but I'm out of context. I'm a bit packed right now to look into this; if I free some of my time I'll try to take a look. |
Thanks again for your time. It motivates me not to give up:-) I think I can spend next week some time trying to understand what values the missing parameters should have. |
Surprisingly I think I have found what to do: In org.ros.internal.node.response.TopicListResultFactory.java line 45 "new TopicDescription(type, null, null)" has to be substituted by "org.ros.internal.message.topic.TopicDescripition.newFromType(type)" I can verify it next week. Should I than create a pull-request, if it works? |
You should create a PR, and please do :) |
Hi, best regards |
To achieve something like
Just iterate through topicList and you'll be able to retrieve all topics with corresponding publishers and subscribers. |
Good evening people :)
i am trying to understand if it is possible to "send" a ROS command like 'rostopic list' to a connected PC via android device.
i have fairly understand how the ROS apks works,i made one on my own too but i cant find a way to actually read the topics of the PC i am connected to,from my apk.Any ideas ? do i need rosjava ?thanks
The text was updated successfully, but these errors were encountered: