Ask Your Question
1

ROSJava Android connect w/o using RosActivity

asked 2012-09-07 06:15:13 -0500

MaxSchmid gravatar image

I am somewhat new to ROSJava for Android. Is there any way to connect an Android device to a Master without extending RosActivity? Basically, all I am trying to do is publish 8 float values (4 (x,y) positions) to a master.

Thank you for your help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-09-09 04:05:50 -0500

orion gravatar image

updated 2012-09-09 04:08:37 -0500

You can use the old way they used to do things. I was also in the situation where I absolutely could not use RosActivity (since I was already extending). I dug in to their ROSActivity and a few of their tutorials to find the below. Hope it helps.

The method I currently use is:

nodeConfiguration = NodeConfiguration
                        .newPublic(InetAddressFactory.newNonLoopback()
                                .getHostAddress());

String hostMaster = prefs.getString("ros_IP", "");
Integer port = Integer.parseInt(prefs.getString("ros_port",
                        ""));
URI uri = URI.create("http://" + hostMaster + ":" + port);
nodeConfiguration.setMasterUri(uri);

nodeMainExecutor = DefaultNodeMainExecutor.newDefault();
nodeMainExecutor.execute(<NAMEOFNODECLASS>, nodeConfiguration);

I am using a preference menu to hold the hostMaster IP and port, but you can change those directly.

I have been working with ROSJava a lot lately and have been looking for some people who may be more involved in it to hit questions back and forth. I hope this helps you.

edit flag offensive delete link more

Comments

Does this solution work for you or do you need another way?

orion gravatar image orion  ( 2012-09-23 10:24:59 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-09-07 06:15:13 -0500

Seen: 356 times

Last updated: Sep 09 '12