Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 92

rosjava: Get List of Parameters

$
0
0
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(); @SuppressWarnings("unchecked") List ParamJavaList = (List) ParamList.getList(NodeName[1]); final ArrayAdapter ParamListAdapter = new ArrayAdapter(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!

Viewing all articles
Browse latest Browse all 92

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>