Exemplo n.º 1
0
  public static void main(String[] argv) throws Exception {
    if (argv.length == 0) {
      printUsage();
      System.exit(1);
    }
    ArrayList<String> l1 = new ArrayList<String>();
    for (int i = 0; i < argv.length; i++) l1.add(argv[i]);
    CommandLineLoader loader = new CommandLineLoader(l1);
    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);
    }

    assert (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);
    }
  }