Esempio n. 1
0
def delete_ros_file(filename):
    log.info("delete pcd file: {}".format(filename))
    try:
        bag_dir = current_app.config.get('BAG_DIR')
        file = os.path.join(app.root_path, bag_dir) + filename
        fileutil.delete(file)
        return ResponseModel.ok('done')
    except Exception, ex:
        traceback.print_exc()
        log.error(ex.message)
        return ResponseModel.error(ex.message)
Esempio n. 2
0
 def force_type(cls, ResponseModel, environ=None):
     if isinstance(Response, (list, dict, object)):
         response = jsonify(ResponseModel.serialze())
     return super(Response, cls).force_type(response, environ)
Esempio n. 3
0
def get_record_files():
    bag_dir = current_app.config.get('BAG_DIR')
    return ResponseModel.ok(fileutil.get_ros_bag_files(bag_dir))
Esempio n. 4
0
def ros_record_close():
    while not rospy.is_shutdown():
        RosCommon().close()
    return ResponseModel.msg('ros record closed!')
Esempio n. 5
0
def ros_record():
    try:
        RosCommon().record()
    except Exception, e:
        traceback.print_exc()
        return ResponseModel.error(e.message)
Esempio n. 6
0
def ros_launch_start():
    try:
        RosCommon().launch_start('test.launch')
    except Exception, e:
        traceback.print_exc()
        return ResponseModel.error(e.message)
Esempio n. 7
0
log = logging.getLogger(__name__)


def validate_json(json):
    if not json or not hasattr(json, 'items'):
        raise NoJsonException()


@api.route('/launch/start', methods=['GET', 'POST'])
def ros_launch_start():
    try:
        RosCommon().launch_start('test.launch')
    except Exception, e:
        traceback.print_exc()
        return ResponseModel.error(e.message)
    return ResponseModel.ok('launch start')


@api.route('/record', methods=['GET'])
def ros_record():
    try:
        RosCommon().record()
    except Exception, e:
        traceback.print_exc()
        return ResponseModel.error(e.message)
    return ResponseModel.ok('ros record done!')


@api.route('/close', methods=['GET', 'POST'])
def ros_record_close():
    while not rospy.is_shutdown():