• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Time类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.ros.message.Time的典型用法代码示例。如果您正苦于以下问题:Java Time类的具体用法?Java Time怎么用?Java Time使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Time类属于org.ros.message包,在下文中一共展示了Time类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCurrentTime

import org.ros.message.Time; //导入依赖的package包/类
Time getCurrentTime() {

        long msecs = System.currentTimeMillis();
        switch (pref.getInt("quadControl", 1)) {
            case 1:
                msecs = msecs - mRef1;
                break;
            case 2:
                msecs = msecs - mRef2;
                break;
            case 3:
                msecs = msecs - mRef3;
                break;
        }

        Time mTime = new Time();
        mTime.secs = (int) (msecs / 1000);
        mTime.nsecs = (int)((msecs % 1000) * 1000000);

        return mTime;
    }
 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:22,代码来源:CanvasView.java


示例2: startPublishing

import org.ros.message.Time; //导入依赖的package包/类
private void startPublishing(ConnectedNode connectedNode) {
    connectedNode.executeCancellableLoop(new CancellableLoop() {
        @Override
        protected void loop() throws InterruptedException {
            WallTimeRate rate = new WallTimeRate(mPublishRate);

            if (!mTfList.isEmpty()) {
                Time time = Time.fromMillis(System.currentTimeMillis());
                for (TransformStamped tfs : mTfList) {
                    tfs.getHeader().setStamp(time);
                }

                TFMessage tfm = mTfPublisher.newMessage();
                tfm.setTransforms(mTfList);
                mTfPublisher.publish(tfm);
            }
            rate.sleep();
        }
    });
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:21,代码来源:ExtrinsicsTfPublisherNode.java


示例3: onSensorChanged

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void onSensorChanged(SensorEvent event) {
  if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
    float[] quaternion = new float[4];
    SensorManager.getQuaternionFromVector(quaternion, event.values);
    PoseStamped pose = publisher.newMessage();
    pose.getHeader().setFrameId("/map");
    // TODO(damonkohler): Should get time from the Node.
    pose.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
    pose.getPose().getOrientation().setW(quaternion[0]);
    pose.getPose().getOrientation().setX(quaternion[1]);
    pose.getPose().getOrientation().setY(quaternion[2]);
    pose.getPose().getOrientation().setZ(quaternion[3]);
    publisher.publish(pose);
  }
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:17,代码来源:OrientationPublisher.java


示例4: updateLocation

import org.ros.message.Time; //导入依赖的package包/类
public void updateLocation(Location location) {
		//TODO: fill out rest of nav information, and also publish velocity and time_reference
//		sensor_msgs.NavSatStatus.
		sensor_msgs.NavSatFix msg = fixPublisher.newMessage();
		//time since jan 1 1970...convert msec to seconds (double)
		msg.getHeader().setStamp(new Time(location.getTime()/1000.0));
		//NOTE: this may not be right...android reports alt above sealevel, ROS expects altitude above ellipsoid
		msg.setAltitude(location.getAltitude());
		msg.setLatitude(location.getLatitude());
		msg.setLongitude(location.getLongitude());
//		sensor_msgs.NavSatStatus status;
//		status.
		//TODO: accuracy, velocity (Twist)
		// TODO Auto-generated method stub
		fixPublisher.publish(msg);
	}
 
开发者ID:gtagency,项目名称:android_nav,代码行数:17,代码来源:AndroidLocationNode.java


示例5: setTraj1

import org.ros.message.Time; //导入依赖的package包/类
void setTraj1(ArrayList<Float> x, ArrayList<Float> y, ArrayList<Float> z, ArrayList<Time> t) {
    xes1 = x;
    yes1 = y;
    zes1 = z;
    tes1 = t;
    publishToggle1 = true;
    Log.i("Traj1","Arrays transferred to node");
}
 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:9,代码来源:ROSNode.java


示例6: setTraj2

import org.ros.message.Time; //导入依赖的package包/类
void setTraj2(ArrayList<Float> x, ArrayList<Float> y, ArrayList<Float> z, ArrayList<Time> t) {
    xes2 = x;
    yes2 = y;
    zes2 = z;
    tes2 = t;
    publishToggle2 = true;
    Log.i("Traj2","Arrays transferred to node");
}
 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:9,代码来源:ROSNode.java


示例7: setTraj3

import org.ros.message.Time; //导入依赖的package包/类
void setTraj3(ArrayList<Float> x, ArrayList<Float> y, ArrayList<Float> z, ArrayList<Time> t) {
    xes3 = x;
    yes3 = y;
    zes3 = z;
    tes3 = t;
    publishToggle3 = true;
    Log.i("Traj3","Arrays transferred to node");
}
 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:9,代码来源:ROSNode.java


示例8: fillInformation

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void fillInformation(MapMetaData information) {
    information.setMapLoadTime(Time.fromMillis(System.currentTimeMillis()));
    // Set the origin to the center of the map
    Pose origin = information.getOrigin();
    origin.getPosition().setX(-1 * WIDTH * RESOLUTION / 2);
    origin.getPosition().setY(-1 * HEIGHT * RESOLUTION / 2);
    Quaternion.identity().toQuaternionMessage(origin.getOrientation());
    information.setWidth(WIDTH);
    information.setHeight(HEIGHT);
    information.setResolution(RESOLUTION);
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:13,代码来源:EmptyMapGenerator.java


示例9: onStart

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void onStart(ConnectedNode connectedNode) {
    final Publisher<DiagnosticArray> batteryPublisher = connectedNode.newPublisher(TOPIC_NAME, DiagnosticArray._TYPE);
    final DiagnosticArray diagnosticArray = batteryPublisher.newMessage();

    final DiagnosticStatus deviceBattery = mMessageFactory.newFromType(DiagnosticStatus._TYPE);
    deviceBattery.setName("/Power System/Laptop Battery");
    KeyValue deviceKeyValueCapacity = mMessageFactory.newFromType(KeyValue._TYPE);
    deviceKeyValueCapacity.setKey("Capacity (Ah)");
    deviceKeyValueCapacity.setValue("100.0");
    final KeyValue deviceKeyValueCharge = mMessageFactory.newFromType(KeyValue._TYPE);
    deviceKeyValueCharge.setKey("Charge (Ah)");
    deviceBattery.setValues(Arrays.asList(deviceKeyValueCapacity, deviceKeyValueCharge));

    diagnosticArray.setStatus(Arrays.asList(deviceBattery));

    connectedNode.executeCancellableLoop(new CancellableLoop() {
        @Override
        protected void loop() throws InterruptedException {
            diagnosticArray.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));

            double deviceBatteryPercentage = mBatteryLevel.get();
            if (deviceBatteryPercentage > 0) {
                deviceKeyValueCharge.setValue(Double.toString(deviceBatteryPercentage));
            }

            batteryPublisher.publish(diagnosticArray);
            Thread.sleep(1000);
        }
    });
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:32,代码来源:DeviceBatteryPublisherNode.java


示例10: onStart

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void onStart(ConnectedNode connectedNode) {
    final Publisher<DiagnosticArray> batteryPublisher = connectedNode.newPublisher(TOPIC_NAME, DiagnosticArray._TYPE);
    final DiagnosticArray diagnosticArray = batteryPublisher.newMessage();
    final DiagnosticStatus robotBattery = mMessageFactory.newFromType(DiagnosticStatus._TYPE);
    robotBattery.setName("/Power System/Battery");
    final KeyValue robotKeyValueCapacity = mMessageFactory.newFromType(KeyValue._TYPE);
    robotKeyValueCapacity.setKey("Capacity (Ah)");
    robotKeyValueCapacity.setValue("100.0");
    final KeyValue robotKeyValueCharge = mMessageFactory.newFromType(KeyValue._TYPE);
    robotKeyValueCharge.setKey("Charge (Ah)");
    robotBattery.setValues(Arrays.asList(robotKeyValueCapacity, robotKeyValueCharge));

    diagnosticArray.setStatus(Arrays.asList(robotBattery));

    connectedNode.executeCancellableLoop(new CancellableLoop() {
        @Override
        protected void loop() throws InterruptedException {
            diagnosticArray.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
            double baseBatteryVoltage = UnsignedBytes.toInt(mBaseDevice.getBaseStatus().getBattery()) * 0.1;
            double baseBatteryPercentage =
                    (baseBatteryVoltage - BASE_MIN_VOLTAGE) /
                            (BASE_MAX_VOLTAGE - BASE_MIN_VOLTAGE) * 100.0;
            robotKeyValueCharge.setValue(Double.toString(baseBatteryPercentage));

            batteryPublisher.publish(diagnosticArray);
            Thread.sleep(1000);
        }
    });
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:31,代码来源:RobotBatteryPublisherNode.java


示例11: stopAllMotion

import org.ros.message.Time; //导入依赖的package包/类
public void stopAllMotion() {
    if (mPublisher == null) {
        return;
    }

    ff_msgs.CommandStamped cmdToSend = mPublisher.newMessage();
    std_msgs.Header hdr = mMsgFac.newFromType(Header._TYPE);
    Time myTime = new Time();
    myTime.secs = 1487370000;
    myTime.nsecs = 0;
    hdr.setStamp(myTime);
    cmdToSend.setHeader(hdr);
    // Command names listed in CommandConstants.h
    cmdToSend.setCmdName(ff_msgs.CommandConstants.CMD_NAME_STOP_ALL_MOTION);

    // Command id needs to be a unique id that you will use make sure the command
    // was executed, usually a combination of username and timestamp
    // move_cmd.setCmdId("guest_science_1");
    cmdToSend.setCmdId("guest_science_" + ff_msgs.CommandConstants.CMD_NAME_STOP_ALL_MOTION);

    // Source of the command, set to guest_science so that the system knows that
    // the command didn't come from the ground
    cmdToSend.setCmdSrc("guest_science");

    ff_msgs.CommandArg cmdArg1 = mMsgFac.newFromType(CommandArg._TYPE);

    // can really set it to anything
    cmdArg1.setDataType(ff_msgs.CommandArg.DATA_TYPE_STRING);
    cmdArg1.setS("world");

    List<CommandArg> args = new ArrayList<CommandArg>();
    args.add(cmdArg1);

    cmdToSend.setArgs(args);

    mPublisher.publish(cmdToSend);
}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:38,代码来源:GuestScienceRosMessages.java


示例12: onNewRawImage

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void onNewRawImage(byte[] data, Size size) {
  Preconditions.checkNotNull(data);
  Preconditions.checkNotNull(size);
  if (data != rawImageBuffer || !size.equals(rawImageSize)) {
    rawImageBuffer = data;
    rawImageSize = size;
    yuvImage = new YuvImage(rawImageBuffer, ImageFormat.NV21, size.width, size.height, null);
    rect = new Rect(0, 0, size.width, size.height);
  }

  Time currentTime = connectedNode.getCurrentTime();
  String frameId = "camera";

  sensor_msgs.CompressedImage image = imagePublisher.newMessage();
  image.setFormat("jpeg");
  image.getHeader().setStamp(currentTime);
  image.getHeader().setFrameId(frameId);

  Preconditions.checkState(yuvImage.compressToJpeg(rect, 20, stream));
  image.setData(stream.buffer().copy());
  stream.buffer().clear();

  imagePublisher.publish(image);

  sensor_msgs.CameraInfo cameraInfo = cameraInfoPublisher.newMessage();
  cameraInfo.getHeader().setStamp(currentTime);
  cameraInfo.getHeader().setFrameId(frameId);

  cameraInfo.setWidth(size.width);
  cameraInfo.setHeight(size.height);
  cameraInfoPublisher.publish(cameraInfo);
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:34,代码来源:CompressedImagePublisher.java


示例13: setCompressedImage

import org.ros.message.Time; //导入依赖的package包/类
private void setCompressedImage(Mat inputFrame, tms_ss_rcnn.obj_detectionRequest request) throws IOException {
    Time time = mConnectedNode.getCurrentTime();
    request.getImage().getHeader().setStamp(time);
    request.getImage().getHeader().setFrameId("ObjectDetection");
    request.getImage().getHeader().setSeq(sequenceNumber++);
    request.getImage().setFormat("jpg");

    MatOfByte buf = new MatOfByte();
    Highgui.imencode(".jpg", inputFrame, buf);
    ChannelBufferOutputStream stream = new ChannelBufferOutputStream(MessageBuffers.dynamicBuffer());
    stream.write(buf.toArray());

    request.getImage().setData(stream.buffer().copy());
}
 
开发者ID:kazuto1011,项目名称:ros-tms-perception,代码行数:15,代码来源:ObjectDetectionClient.java


示例14: fillHeader

import org.ros.message.Time; //导入依赖的package包/类
@Override
public void fillHeader(Header header) {
    header.setFrameId("map");
    header.setStamp(Time.fromMillis(System.currentTimeMillis()));
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:6,代码来源:EmptyMapGenerator.java


示例15: armPanAndTilt

import org.ros.message.Time; //导入依赖的package包/类
public void armPanAndTilt(float pan, float tilt, String componentToMove) {
    if (mPublisher == null) {
        return;
    }

    ff_msgs.CommandStamped cmdToSend = mPublisher.newMessage();
    std_msgs.Header hdr = mMsgFac.newFromType(Header._TYPE);
    Time myTime = new Time();
    myTime.secs = 1487370000;
    myTime.nsecs = 0;
    hdr.setStamp(myTime);
    cmdToSend.setHeader(hdr);
    // Command names listed in CommandConstants.h
    cmdToSend.setCmdName(ff_msgs.CommandConstants.CMD_NAME_ARM_PAN_AND_TILT);

    // Command id needs to be a unique id that you will use make sure the command
    // was executed, usually a combination of username and timestamp
    cmdToSend.setCmdId("guest_science_" + ff_msgs.CommandConstants.CMD_NAME_ARM_PAN_AND_TILT);

    // Source of the command, set to guest_science so that the system knows that
    // the command didn't come from the ground
    cmdToSend.setCmdSrc("guest_science");

    // Set the ARM component to move
    ff_msgs.CommandArg cmdArg1 = mMsgFac.newFromType(CommandArg._TYPE);
    cmdArg1.setDataType(ff_msgs.CommandArg.DATA_TYPE_FLOAT);
    cmdArg1.setF(pan);

    // Set the ARM angle1 to move
    ff_msgs.CommandArg cmdArg2 = mMsgFac.newFromType(CommandArg._TYPE);
    cmdArg2.setDataType(CommandArg.DATA_TYPE_FLOAT);
    cmdArg2.setF(tilt);

    // Set the ARM angle2 to move
    ff_msgs.CommandArg cmdArg3 = mMsgFac.newFromType(CommandArg._TYPE);
    cmdArg3.setDataType(CommandArg.DATA_TYPE_STRING);
    cmdArg3.setS(componentToMove);

    List<CommandArg> args = new ArrayList<CommandArg>();
    args.add(cmdArg1);
    args.add(cmdArg2);
    args.add(cmdArg3);

    cmdToSend.setArgs(args);

    mPublisher.publish(cmdToSend);

}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:49,代码来源:GuestScienceRosMessages.java


示例16: move

import org.ros.message.Time; //导入依赖的package包/类
public void move(String cmdId, double[] pos) {
    if (mPublisher == null) {
        return;
    }

    ff_msgs.CommandStamped cmdToSend = mPublisher.newMessage();
    std_msgs.Header hdr = mMsgFac.newFromType(Header._TYPE);
    Time myTime = new Time();
    myTime.secs = 1487370000;
    myTime.nsecs = 0;
    hdr.setStamp(myTime);
    cmdToSend.setHeader(hdr);
    // Command names listed in CommandConstants.h
    cmdToSend.setCmdName(ff_msgs.CommandConstants.CMD_NAME_SIMPLE_MOVE6DOF);

    // Command id needs to be a unique id that you will use make sure the command
    // was executed, usually a combination of username and timestamp
    cmdToSend.setCmdId("guest_science_" + cmdId);

    // Source of the command, set to guest_science so that the system knows that
    // the command didn't come from the ground
    cmdToSend.setCmdSrc("guest_science");

    ff_msgs.CommandArg cmdArg1 = mMsgFac.newFromType(CommandArg._TYPE);

    // can really set it to anything
    cmdArg1.setDataType(ff_msgs.CommandArg.DATA_TYPE_STRING);
    cmdArg1.setS("world");

    List<CommandArg> args = new ArrayList<CommandArg>();
    args.add(cmdArg1);

    ff_msgs.CommandArg cmdArg2 = mMsgFac.newFromType(CommandArg._TYPE);
    // Set location where you want Astrobee to go to
    cmdArg2.setDataType(ff_msgs.CommandArg.DATA_TYPE_VEC3d);

    cmdArg2.setVec3d(pos);

    ff_msgs.CommandArg cmdArg3 = mMsgFac.newFromType(CommandArg._TYPE);
    // Set location where you want Astrobee to go to
    cmdArg3.setDataType(ff_msgs.CommandArg.DATA_TYPE_VEC3d);

    double [] tol = {0.0, 0.0, 0.0};
    cmdArg3.setVec3d(tol);

    ff_msgs.CommandArg cmdArg4 = mMsgFac.newFromType(CommandArg._TYPE);
    // Set location where you want Astrobee to go to
    cmdArg4.setDataType(ff_msgs.CommandArg.DATA_TYPE_MAT33f);

    float [] qt = {0, 0, 0, 1, 0, 0, 0, 0, 0};
    cmdArg4.setMat33f(qt);

    args.add(cmdArg2);
    args.add(cmdArg3);
    args.add(cmdArg4);

    cmdToSend.setArgs(args);

    mPublisher.publish(cmdToSend);

}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:62,代码来源:GuestScienceRosMessages.java


示例17: sendMessage

import org.ros.message.Time; //导入依赖的package包/类
public void sendMessage() {
    if (mPublisher == null) {
        return;
    }

    ff_msgs.CommandStamped move_cmd = mPublisher.newMessage();
    std_msgs.Header hdr = mMsgFac.newFromType(Header._TYPE);
    Time myTime = new Time();
    myTime.secs = 1487370000;
    myTime.nsecs = 0;
    hdr.setStamp(myTime);
    //hdr.setStamp(mNodeConfig.getTimeProvider().getCurrentTime());
    move_cmd.setHeader(hdr);
    // Command names listed in CommandConstants.h
    move_cmd.setCmdName(ff_msgs.CommandConstants.CMD_NAME_SIMPLE_MOVE6DOF);

    // Command id needs to be a unique id that you will use make sure the command
    // was executed, usually a combination of username and timestamp
    move_cmd.setCmdId("guest_science_1");

    // Source of the command, set to guest_science so that the system knows that
    // the command didn't come from the ground
    move_cmd.setCmdSrc("guest_science");

    ff_msgs.CommandArg cmdArg1 = mMsgFac.newFromType(CommandArg._TYPE);

    // can really set it to anything
    cmdArg1.setDataType(ff_msgs.CommandArg.DATA_TYPE_STRING);
    cmdArg1.setS("world");

    List<CommandArg> args = new ArrayList<CommandArg>();
    args.add(cmdArg1);


    ff_msgs.CommandArg cmdArg2 = mMsgFac.newFromType(CommandArg._TYPE);

    // Set location where you want Astrobee to go to
    cmdArg2.setDataType(ff_msgs.CommandArg.DATA_TYPE_VEC3d);

    double [] pos = {1.0, 1.0, 0.0};
    cmdArg2.setVec3d(pos);

    ff_msgs.CommandArg cmdArg3 = mMsgFac.newFromType(CommandArg._TYPE);

    // Set location where you want Astrobee to go to
    cmdArg3.setDataType(ff_msgs.CommandArg.DATA_TYPE_VEC3d);


    double [] tol = {0.0, 0.0, 0.0};
    cmdArg3.setVec3d(tol);

    ff_msgs.CommandArg cmdArg4 = mMsgFac.newFromType(CommandArg._TYPE);

    // Set location where you want Astrobee to go to
    cmdArg4.setDataType(ff_msgs.CommandArg.DATA_TYPE_MAT33f);

    float [] qt = {0, 0, 0, 1, 0, 0, 0, 0, 0};
    cmdArg4.setMat33f(qt);

    args.add(cmdArg2);
    args.add(cmdArg3);
    args.add(cmdArg4);

    move_cmd.setArgs(args);

    mPublisher.publish(move_cmd);

}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:69,代码来源:SimpleNode.java


示例18: getTimesVec1

import org.ros.message.Time; //导入依赖的package包/类
public ArrayList<Time> getTimesVec1() { return timesVec1; } 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:2,代码来源:CanvasView.java


示例19: getTimesVec2

import org.ros.message.Time; //导入依赖的package包/类
public ArrayList<Time> getTimesVec2() { return timesVec2; } 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:2,代码来源:CanvasView.java


示例20: getTimesVec3

import org.ros.message.Time; //导入依赖的package包/类
public ArrayList<Time> getTimesVec3() { return timesVec3; } 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:2,代码来源:CanvasView.java



注:本文中的org.ros.message.Time类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BBFileReader类代码示例发布时间:2022-05-22
下一篇:
Java Function类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap