rosjava: Get List of Parameters
I am developing with ros on an android tablet, and I am trying to change parameters using the device (as a remote, so to speak). However, I am having trouble doing so. Has anyone done this?
Here is my attempt:
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic( InetAddressFactory.newNonLoopback().getHostAddress());
nodeConfiguration.setMasterUri(URI.create(IP_ADDRESS));
ListView ParamListView = (ListView) findViewById(R.id.ParamListView);
final String[] NodeName = url.split("=");
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(Integer.MAX_VALUE);
NodeFactory nodeFactory = new DefaultNodeFactory(scheduledExecutorService);
Node node = nodeFactory.newNode(nodeConfiguration);
ConnectedNode connectednode = (ConnectedNode) node;
final ParameterTree ParamList = connectednode.getParameterTree();
//final ParameterTree ParamList = (ParameterTree) new ArrayList<String>();
@SuppressWarnings("unchecked")
List<String> ParamJavaList = (List<String>) ParamList.getList(NodeName[1]);
final ArrayAdapter<String> ParamListAdapter = new ArrayAdapter<String>(this, android.R.id.text1, ParamJavaList);
ParamListView.setAdapter(ParamListAdapter);
What am I doing wrong? I am not sure how to copy and paste my error log, but the error is is occurring before my call of getList().
If I uncomment the commented line and comment out the 5 lines before it, I get an error saying I cannot cast from ArrayList to ParameterTree. That is how I got to this convoluted point of trying to initialize the ParamList using getParameterTree(), which requires access to the connected node.
I am sure there is an easier way to do this, but I am not aware of it.
Thanks in advance!