Ask Your Question
0

two nodes on ros android

asked 2015-04-27 09:26:18 -0500

zior89 gravatar image

Hello!

Do you know how can I run two nodes en a same activity on android?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-12-04 11:52:05 -0500

jubeira gravatar image

You can run any number of nodes within an activity. Simply do something like this (assuming your activity is a RosActivity):

@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
    nodeConfiguration.setMasterUri(getMasterUri());

    nodeConfiguration.setNodeName("node_1");
    MyNode myNode1 = new MyNode();     // Something that extends AbstractNodeMain
    nodeMainExecutor.execute(myNode1, nodeConfiguration);

    nodeConfiguration.setNodeName("node_2");
    MyNode myNode2 = new MyNode();
    nodeMainExecutor.execute(myNode2, nodeConfiguration);     // And so on...
}
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-27 09:26:18 -0500

Seen: 109 times

Last updated: Dec 04 '17