/** * @return an instance of {@link DefaultNodeMainExecutor} that uses a * {@link ScheduledExecutorService} that is suitable for both * executing tasks immediately and scheduling tasks to execute in the * future */ public static NodeMainExecutor newDefault() { return newDefault(new DefaultScheduledExecutorService()); }
public void execute() { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(masterURI); nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(this, nodeConfiguration); }
public void execute() { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(masterURI); nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(this, nodeConfiguration); }
public static void main(String[] args) throws URISyntaxException { String MASTER = "http://localhost:11311"; String TOPIC_NAME = "/camera/image_raw/compressed"; URI master = new URI(MASTER); try { RosCameraBenchmarker externalCamera = new RosCameraBenchmarker(TOPIC_NAME); NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(master); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(externalCamera, nodeConfiguration); } catch (Exception e) { e.printStackTrace(); } } }
public static void main(String[] args) throws URISyntaxException { String MASTER = "http://localhost:11311"; String TOPIC_NAME = "/camera/image_raw/compressed"; URI master = new URI(MASTER); try { RosCameraBenchmarker externalCamera = new RosCameraBenchmarker(TOPIC_NAME); NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(master); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(externalCamera, nodeConfiguration); } catch (Exception e) { e.printStackTrace(); } } }
public static void main(String[] args) throws URISyntaxException { String MASTER = "http://localhost:11311"; String TOPIC_NAME = "/camera/image_raw/compressed"; URI master = new URI(MASTER); try { RosCameraBenchmarker externalCamera = new RosCameraBenchmarker(TOPIC_NAME); NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(master); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(externalCamera, nodeConfiguration); } catch (Exception e) { e.printStackTrace(); } } }
public static void main(String[] args) throws URISyntaxException { try { if (args.length < 3) throw new IllegalArgumentException("Insufficient arguments provided. Please provide IP of MASTER, camera name, and topic name."); else { URI master = new URI(args[0]); ExternalCameraFeed externalCamera; if (args.length == 3) externalCamera = new ExternalCameraFeed(args[1], args[2]); else externalCamera = new ExternalCameraFeed(args[1], args[2], args[3].equals("true")); NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(master); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(externalCamera, nodeConfiguration); } } catch (Exception e) { e.printStackTrace(); } } }
public ROSiRobotCommandDispatcher(PacketCommunicator ihmcMessageCommunicator, String rosHostIP) { ihmcMessageCommunicator.attachListener(HandDesiredConfigurationMessage.class, handDesiredConfigurationMessageSubscriber); String rosURI = "http://" + rosHostIP + ":11311"; rosHandCommunicator = new ROSiRobotCommunicator(rosURI); try { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(new URI(rosURI)); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(rosHandCommunicator, nodeConfiguration); } catch (URISyntaxException e) { e.printStackTrace(); } }
public ROSiRobotCommandDispatcher(PacketCommunicator ihmcMessageCommunicator, String rosHostIP) { ihmcMessageCommunicator.attachListener(HandDesiredConfigurationMessage.class, handDesiredConfigurationMessageSubscriber); String rosURI = "http://" + rosHostIP + ":11311"; rosHandCommunicator = new ROSiRobotCommunicator(rosURI); try { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(new URI(rosURI)); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(rosHandCommunicator, nodeConfiguration); } catch (URISyntaxException e) { e.printStackTrace(); } }
public ROSiRobotCommandDispatcher(String robotName, RealtimeRos2Node realtimeRos2Node, String rosHostIP) { ROS2Tools.createCallbackSubscription(realtimeRos2Node, HandDesiredConfigurationMessage.class, ControllerAPIDefinition.getSubscriberTopicNameGenerator(robotName), handDesiredConfigurationMessageSubscriber); String rosURI = "http://" + rosHostIP + ":11311"; rosHandCommunicator = new ROSiRobotCommunicator(rosURI); try { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(new URI(rosURI)); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(rosHandCommunicator, nodeConfiguration); } catch (URISyntaxException e) { e.printStackTrace(); } }
public static void main(String[] argv) throws Exception { if (argv.length == 0) { printUsage(); System.exit(1); } CommandLineLoader loader = new CommandLineLoader(Lists.newArrayList(argv)); String nodeClassName = loader.getNodeClassName(); System.out.println("Loading node class: " + loader.getNodeClassName()); NodeConfiguration nodeConfiguration = loader.build(); NodeMain nodeMain = null; try { nodeMain = loader.loadClass(nodeClassName); } catch (ClassNotFoundException e) { throw new RosRuntimeException("Unable to locate node: " + nodeClassName, e); } catch (InstantiationException e) { throw new RosRuntimeException("Unable to instantiate node: " + nodeClassName, e); } catch (IllegalAccessException e) { throw new RosRuntimeException("Unable to instantiate node: " + nodeClassName, e); } Preconditions.checkState(nodeMain != null); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(nodeMain, nodeConfiguration); } }
public RosConnectedZeroPoseRobotConfigurationDataProducer(URI rosMasterURI, PacketCommunicator objectCommunicator, final DRCRobotModel robotModel) { this.robotModel = robotModel; this.packetCommunicator = objectCommunicator; fullRobotModel = robotModel.createFullRobotModel(); referenceFrames = new HumanoidReferenceFrames(fullRobotModel); pelvisFrame = referenceFrames.getPelvisFrame(); headFrame = referenceFrames.getNeckFrame(NeckJointName.PROXIMAL_NECK_PITCH); forceSensorDefinitions = fullRobotModel.getForceSensorDefinitions(); updateRobotLocationBasedOnMultisensePose(new RigidBodyTransform()); if(rosMasterURI != null) { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(rosMasterURI); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(this, nodeConfiguration); } }
public RosConnectedZeroPoseRobotConfigurationDataProducer(URI rosMasterURI, PacketCommunicator objectCommunicator, final DRCRobotModel robotModel) { this.robotModel = robotModel; this.packetCommunicator = objectCommunicator; fullRobotModel = robotModel.createFullRobotModel(); referenceFrames = new HumanoidReferenceFrames(fullRobotModel); pelvisFrame = referenceFrames.getPelvisFrame(); headFrame = referenceFrames.getNeckFrame(NeckJointName.PROXIMAL_NECK_PITCH); forceSensorDefinitions = fullRobotModel.getForceSensorDefinitions(); updateRobotLocationBasedOnMultisensePose(new RigidBodyTransform()); if(rosMasterURI != null) { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(rosMasterURI); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(this, nodeConfiguration); } }
public RosConnectedZeroPoseRobotConfigurationDataProducer(URI rosMasterURI, PacketCommunicator objectCommunicator, final DRCRobotModel robotModel) { this.robotModel = robotModel; this.packetCommunicator = objectCommunicator; fullRobotModel = robotModel.createFullRobotModel(); referenceFrames = new HumanoidReferenceFrames(fullRobotModel); pelvisFrame = referenceFrames.getPelvisFrame(); headFrame = referenceFrames.getNeckFrame(NeckJointName.PROXIMAL_NECK_PITCH); forceSensorDefinitions = fullRobotModel.getForceSensorDefinitions(); updateRobotLocationBasedOnMultisensePose(new RigidBodyTransform()); if(rosMasterURI != null) { NodeConfiguration nodeConfiguration = RosTools.createNodeConfiguration(rosMasterURI); NodeMainExecutor nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeMainExecutor.execute(this, nodeConfiguration); } }
@Before public void setUp() throws InterruptedException { rosCore = RosCore.newPrivate(); rosCore.start(); assertTrue(rosCore.awaitStart(1, TimeUnit.SECONDS)); nodeMainExecutor = DefaultNodeMainExecutor.newDefault(); nodeConfiguration = NodeConfiguration.newPrivate(rosCore.getUri()); }