Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exception patch #11

Open
wants to merge 2 commits into
base: indigo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.github.robotics_in_concert.rocon_rosjava_core.rosjava_utils.RosTopicInfo;
import com.google.common.collect.Lists;

import org.ros.exception.RosRuntimeException;
import org.ros.internal.loader.CommandLineLoader;
import org.ros.namespace.GraphName;
import org.ros.node.AbstractNodeMain;
Expand All @@ -31,13 +32,21 @@ public MasterInfo() {
this.masterInfoListener = new ListenerNode<rocon_std_msgs.MasterInfo>();
}
@Override
public void onStart(final ConnectedNode connectedNode) {
RosTopicInfo topicInformation = new RosTopicInfo(connectedNode);
String topicName = topicInformation.findTopic("rocon_std_msgs/MasterInfo");
this.masterInfoListener.connect(connectedNode, topicName, rocon_std_msgs.MasterInfo._TYPE);
}
public void onStart (final ConnectedNode connectedNode) {
try{
RosTopicInfo topicInformation = new RosTopicInfo(connectedNode);
String topicName = topicInformation.findTopic("rocon_std_msgs/MasterInfo");
this.masterInfoListener.connect(connectedNode, topicName, rocon_std_msgs.MasterInfo._TYPE);
} catch (RosRuntimeException e){
try {
throw new MasterInfoException(e.getMessage());
} catch (MasterInfoException e1) {
e1.printStackTrace();
}
}
}

/**
/**
* Wait for data to come in. This uses a default timeout
* set by ListenerNode.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,21 @@ public void onStart(final ConnectedNode connectedNode) {
}
} catch (ServiceNotFoundException e) {
// should be having some sort of error flag that can be picked up in waitForResponse
return;
try {
throw new ServiceNotFoundException(e.getMessage());
} catch (ServiceNotFoundException e1) {
e1.printStackTrace();
}
}
catch (RosRuntimeException e) {
// should be having some sort of error flag that can be picked up in waitForResponse
try {
throw new RosRuntimeException (e.getMessage());
} catch (RosRuntimeException e1) {
e1.printStackTrace();
}
return;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*****************************************************************************/

import org.ros.exception.RemoteException;
import org.ros.exception.RosRuntimeException;
import org.ros.exception.ServiceNotFoundException;
import org.ros.namespace.NameResolver;
import org.ros.namespace.NodeNameResolver;
Expand Down Expand Up @@ -34,8 +35,10 @@ public BlockingServiceClientNode(ConnectedNode connectedNode, String serviceName
srvClient = connectedNode.newServiceClient(resolvedServiceName, serviceType);
} catch (ServiceNotFoundException e) {
throw e;
}
srvClient.call(request, this.setupListener());
} catch (RosRuntimeException e) {
throw e;
}
srvClient.call(request, this.setupListener());
}

public void waitForResponse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void waitForResponse() throws ListenerException, TimeoutException {
throw new ListenerException(e);
}
// timeout.
if ( count == 20 ) {
if ( count == 50 ) {
this.errorMessage = "timed out waiting for a " + subscriber.getTopicName() + "publication";
throw new TimeoutException(this.errorMessage);
}
Expand Down