Tell me how to use parameter server with rosjava
I want to make parameter server with rosjava. But I can not. As far as I've looked up, I can not find the latest information on parameter server anywhere. That's why I want you to help me
I want to use AddTwoInts. However, when executing catkin_make, it says that the package of AddTwolnts can not be found. I guessed I had to edit build.gradle. But I do not know how to edit it
che License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.github.rosjava.test;
import org.apache.commons.logging.Log;
import org.ros.node.Node;
import org.ros.node.NodeMain;
import org.ros.node.service.ServiceClient;
import org.ros.node.service.ServiceResponseListener;
import org.ros.exception.RemoteException;
import org.ros.service.test_ros.AddTwoInts;
import org.ros.namespace.GraphName;
// add for parameter
import org.ros.node.parameter.ParameterTree;
/*
* @author OTL
*/
public class Parameters implements NodeMain {
@Override
public GraphName getDefaultNodeName() {
return new GraphName("rosjava_tutorial_service/client");
}
@Override
public void onStart(Node node) {
try {
ServiceClient<AddTwoInts.Request, AddTwoInts.Response> client =
node.newServiceClient("/add_two_ints", "test_ros/AddTwoInts");
Thread.sleep(100);
AddTwoInts.Request srv = new AddTwoInts.Request();
// add for parameter
ParameterTree params = node.newParameterTree();
srv.a = params.getInteger("/a", 1);
srv.b = params.getInteger("/b", 5);
client.call(srv, new ServiceResponseListener<AddTwoInts.Response>() {
@Override
public void onSuccess(AddTwoInts.Response res) {
log.info("call service success! " + res.sum);
}
@Override
public void onFailure(RemoteException arg) {
log.info("call service fail");
}
});
} catch (Exception e) {
if (node != null) {
node.getLog().fatal(e);
} else {
e.printStackTrace();
}
}
}
@Override
public void onShutdown(Node node) {
}
@Override
public void onShutdownComplete(Node node) {
}
}