最近在做物联网平台的协议开发,但是因为前端设备厂家较多,而且根据使用的场景和使用的用途,协议也大小不一,各种各样的协议都有,但是为了来兼容这些协议,必须要设计一些插件或者脚本来自动进行数据的解析和数据的封装。然后调查了一下,市面上使用较为广泛的是lua和js,这两个脚本型语言使用的人生较多,用起来也比较容易上手。

然后在对脚本支持上就麻烦了,毕竟没有没有那么多的时间来做这方面的工作。然后在网站找了相关资料,还是决定从LuaJit入手,毕竟之前一直在做嵌入式的开发,对C的移植和使用也比较熟悉,然后使用LuaJit运行的时间也比较款,因此决定,还是从LuaJit下手。

我们简单的来看看LuaJit的相关知识和优缺点。

一、LuaJIT主要由以下四部分组成:

  1. 语法实现。
  2. Trace JIT编译器。
  3. 库函数。
    1. 原生库++(强化过的原生库)
    2. bit
    3. ffi
    4. jit
  4. 字节码。

注:最新luajit对应lua5.1.5。

二、为什么要使用LuaJit
解释执行:

效率低。
代码暴露。
静态编译:

不够灵活,无法热更新。
平台兼容性差。
JIT:

效率:高于解释执行,低于静态编译。
安全性:一般都会先转换成字节码。
热更新:无论源码还是字节码本质上都是资源文件。
兼容性:虚拟机会处理平台差异,对用户透明。

三、GO和Lua通信的桥梁---->C语言

为了快速打通Go和Lua的使用途径,决定举出大宝剑C语言,毕竟C属于较为底层的语言,各个语言为了实现某些高效率的场景,都有支持C语言,因此决定,从C语言入手,以C语言为桥梁,沟通Go语言和Lua语言,接下来我们看如何在Go语言中使用C语言。

1、启用 CGO 特性

在 golang 代码中加入 import “C” 语句就可以启动 CGO 特性。这样在进行 go build 命令时,就会在编译和连接阶段启动 gcc 编译器。

// go.1.15// test.go
package main
import "C"      // import "C"更像是一个关键字,CGO工具在预处理时会删掉这一行func main() {
}

说明:

当你在包中引用 import "C",go build 就会做很多额外的工作来构建你的代码,构建就不仅仅是向 go tool compile 传递一堆 .go 文件了,而是要先进行以下步骤:

1)cgo 工具就会被调用,在 C 转换 Go、Go 转换 C 的之间生成各种文件。

2)系统的 C 编译器会被调用来处理包中所有的 C 文件。

3)所有独立的编译单元会被组合到一个 .o 文件。

4)生成的 .o 文件会在系统的连接器中对它的引用进行一次检查修复。

cgo 是一个 Go 语言自带的特殊工具,可以使用命令 go tool cgo 来运行。它可以生成能够调用 C 语言代码的 Go 语言源文件,也就是说所有启用了 CGO 特性的 Go 代码,都会首先经过 cgo 的"预处理"。

2.Go 调用自定义 C 程序

// test_call_c.go
package main/*
#cgo LDFLAGS: -L/usr/local/lib#include <stdio.h>
#include <stdlib.h>
#define REPEAT_LIMIT 3              // CGO会保留C代码块中的宏定义
typedef struct{                     // 自定义结构体int repeat_time;char* str;
}blob;
int SayHello(blob* pblob) {  // 自定义函数for ( ;pblob->repeat_time < REPEAT_LIMIT; pblob->repeat_time++){puts(pblob->str);}return 0;
}
*/
import "C"
import ("fmt""unsafe"
)func main() {cblob := C.blob{}                               // 在GO程序中创建的C对象,存储在Go的内存空间cblob.repeat_time = 0cblob.str = C.CString("Hello, World\n")         // C.CString 会在C的内存空间申请一个C语言字符串对象,再将Go字符串拷贝到C字符串ret := C.SayHello(&cblob)                       // &cblob 取C语言对象cblob的地址fmt.Println("ret", ret)fmt.Println("repeat_time", cblob.repeat_time)C.free(unsafe.Pointer(cblob.str))               // C.CString 申请的C空间内存不会自动释放,需要显示调用C中的free释放
}

CGO 会保留序文中的宏定义,但是并不会保留注释,也不支持#program,C 代码块中的#program 语句极可能产生未知错误

CGO 中使用 #cgo 关键字可以设置编译阶段和链接阶段的相关参数,可以使用 ${SRCDIR} 来表示 Go 包当前目录的绝对路径。

使用 C.结构名 或 C.struct_结构名 可以在 Go 代码段中定义 C 对象,并通过成员名访问结构体成员。

test3.go 中使用 C.CString 将 Go 字符串对象转化为 C 字符串对象,并将其传入 C 程序空间进行使用,由于 C 的内存空间不受 Go 的 GC 管理,因此需要显示的调用 C 语言的 free 来进行回收。

四.编译LuaJit库文件

1. 安装 TDM-GCC。

下载并安装 TDM-GCC 编译器 :

下载地址 : tdm-gcc

2.安装 TDM-GCC 编译器

选择支持32位和64位的版本版本

设置安装路径

全部选择

然后等待安装完成,安装完成之后,配置应用程序的路径:

编译源代码并生成库文件

mingw32-make

五、go调用lua支持


#include <luajit.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <stdio.h>
#include <stdlib.h>
#include "_cgo_export.h"extern int sync_extern_method(lua_State* _L);int gluaL_dostring(lua_State* _L, char* script) {int res = luaL_dostring(_L, script);free(script);return res;
}
void glua_getglobal(lua_State* _L, char* name) {lua_getglobal(_L, name);free(name);
}
void glua_setglobal(lua_State* _L, char* name) {lua_setglobal(_L, name);free(name);
}
void glua_pushlightuserdata(lua_State* _L, void* obj) {lua_pushlightuserdata(_L, obj);
}
int glua_pcall(lua_State* _L, int args, int results) {return lua_pcall(_L, args, results, 0);
}
lua_Number glua_tonumber(lua_State* _L, int index) {return lua_tonumber(_L, index);
}
int glua_yield(lua_State *_L, int nresults) {return lua_yield(_L, nresults);
}
const char* glua_tostring(lua_State* _L, int index) {return lua_tostring(_L, index);
}
void glua_pop(lua_State* _L, int num) {lua_pop(_L, num);
}
lua_State *glua_tothread(lua_State* _L, int index) {return lua_tothread(_L, index);
}int glua_istable(lua_State* _L, int index) {return lua_istable(_L, index);
}
void* glua_touserdata(lua_State* _L, int index) {return lua_touserdata(_L, index);
}int glua_resume (lua_State *_L, int narg) {return lua_resume(_L, narg);
}int glua_gettop(lua_State *_L) {return lua_gettop(_L);
}int glua_gc (lua_State *_L, int what, int data) {return lua_gc(_L, what, data);
}lua_State *gluaL_newstate (void) {return luaL_newstate();
}void gluaL_openlibs (lua_State *_L) {luaL_openlibs(_L);
}lua_State *glua_newthread (lua_State *_L) {return lua_newthread(_L);
}void glua_close (lua_State *_L) {lua_close(_L);
}void glua_remove (lua_State *_L, int index) {lua_remove(_L, index);
}int glua_type (lua_State *_L, int index) {return lua_type(_L, index);
}void glua_pushlstring (lua_State *_L, char *s, size_t len) {lua_pushlstring (_L, s, len);free(s);
}void glua_pushnumber (lua_State *_L, lua_Number n) {lua_pushnumber(_L, n);
}void glua_pushboolean (lua_State *_L, int b) {lua_pushboolean(_L, b);
}void glua_pushnil (lua_State *_L) {lua_pushnil(_L);
}void glua_createtable (lua_State *_L, int narr, int nrec) {lua_createtable(_L, narr, nrec);
}void glua_settable (lua_State *_L, int index) {lua_settable (_L, index);
}int glua_next (lua_State *_L, int index) {return lua_next(_L, index);
}int glua_toboolean (lua_State *_L, int index) {return lua_toboolean(_L, index);
}void register_go_method(lua_State* _L) {lua_pushcfunction(_L, &sync_extern_method);lua_setglobal(_L, "sync_extern_method");
}
package libLuaimport (// "fmt"// "strconv""context""sync""unsafe"
)// #cgo CFLAGS: -I/usr/local/include/luajit-2.1
// #cgo LDFLAGS:  -L/usr/local/lib -lluajit -ldl -lm
//#include "libLua.h"
import "C"var (threadCtxDic      map[uintptr]context.ContextthreadCtxDicMutex sync.RWMutex
)func init() {threadCtxDic = make(map[uintptr]context.Context)
}func generateLuaStateId(vm *C.struct_lua_State) uintptr {return uintptr(unsafe.Pointer(vm))
}func createLuaState() (uintptr, *C.struct_lua_State) {vm := C.gluaL_newstate()C.glua_gc(vm, C.LUA_GCSTOP, 0)C.gluaL_openlibs(vm)C.glua_gc(vm, C.LUA_GCRESTART, 0)C.register_go_method(vm)if globalOpts.preloadScriptMethod != nil {script := globalOpts.preloadScriptMethod()C.gluaL_dostring(vm, C.CString(script))}return generateLuaStateId(vm), vm
}func createLuaThread(vm *C.struct_lua_State) (uintptr, *C.struct_lua_State) {L := C.glua_newthread(vm)return generateLuaStateId(L), L
}func pushThreadContext(threadId uintptr, ctx context.Context) {threadCtxDicMutex.Lock()defer threadCtxDicMutex.Unlock()threadCtxDic[threadId] = ctx
}func popThreadContext(threadId uintptr) {threadCtxDicMutex.Lock()defer threadCtxDicMutex.Unlock()delete(threadCtxDic, threadId)
}func findThreadContext(threadId uintptr) context.Context {threadCtxDicMutex.RLock()defer threadCtxDicMutex.RUnlock()return threadCtxDic[threadId]
}
package libLuaimport ("context""crypto/md5""errors""fmt""io/ioutil"
)// #cgo CFLAGS: -I/usr/local/include/luajit-2.1
// #cgo LDFLAGS:  -L/usr/local/lib -lluajit -ldl -lm
//#include "libLua.h"
import "C"type luaVm struct {stateId      uintptrstate        *C.struct_lua_StatescriptMD5Dic map[string]boolresumeCount  intneedDestory  boolthreadDic    map[uintptr]*C.struct_lua_State
}func newLuaVm() *luaVm {stateId, state := createLuaState()return &luaVm{stateId:      stateId,state:        state,resumeCount:  0,needDestory:  false,scriptMD5Dic: make(map[string]bool),threadDic:    make(map[uintptr]*C.struct_lua_State),}
}func (v *luaVm) run(ctx context.Context, luaCtx *luaContext) {metricCounter("glua_vm_run_total", 1, map[string]string{"vm_id": fmt.Sprintf("%d", v.stateId),})metricGauge("glua_vm_memory_size", int64(C.glua_gc(v.state, C.LUA_GCCOUNT, 0)<<10+C.glua_gc(v.state, C.LUA_GCCOUNTB, 0)), map[string]string{"vm_id": fmt.Sprintf("%d", v.stateId),})defer func() {C.glua_gc(v.state, C.LUA_GCCOLLECT, 0)}()threadId, L := createLuaThread(v.state)v.threadDic[threadId] = LluaCtx.luaStateId = v.stateIdluaCtx.luaThreadId = threadIdpushThreadContext(threadId, luaCtx.ctx)ret := C.int(C.LUA_OK)if len(luaCtx.act.script) > 0 {if len(luaCtx.act.entrypoint) > 0 {if len(luaCtx.act.scriptMD5) > 0 {if _, ok := v.scriptMD5Dic[luaCtx.act.scriptMD5]; !ok {v.scriptMD5Dic[luaCtx.act.scriptMD5] = trueret = C.gluaL_dostring(L, C.CString(luaCtx.act.script))}} else {scriptMD5 := fmt.Sprintf("%x", md5.Sum([]byte(luaCtx.act.script)))if _, ok := v.scriptMD5Dic[scriptMD5]; !ok {v.scriptMD5Dic[scriptMD5] = trueret = C.gluaL_dostring(L, C.CString(luaCtx.act.script))}}} else {ret = C.gluaL_dostring(L, C.CString(luaCtx.act.script))}} else {raw, err := ioutil.ReadFile(luaCtx.act.scriptPath)if err != nil {luaCtx.callback <- errors.New(C.GoString(C.glua_tostring(L, -1)))close(luaCtx.callback)v.destoryThread(threadId, L)return}if len(luaCtx.act.entrypoint) > 0 {scriptMD5 := fmt.Sprintf("%x", md5.Sum(raw))if _, ok := v.scriptMD5Dic[scriptMD5]; !ok {v.scriptMD5Dic[scriptMD5] = trueret = C.gluaL_dostring(L, C.CString(string(raw)))}} else {ret = C.gluaL_dostring(L, C.CString(string(raw)))}}if ret == C.LUA_OK && len(luaCtx.act.entrypoint) > 0 {C.glua_getglobal(L, C.CString(luaCtx.act.entrypoint))pushToLua(L, luaCtx.act.params...)ret = C.glua_resume(L, C.int(len(luaCtx.act.params)))}switch ret {case C.LUA_OK:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "success"})luaCtx.status = 3count := int(C.glua_gettop(L))res := make([]interface{}, count)for {count = int(C.glua_gettop(L))if count == 0 {break}res[count-1] = pullFromLua(L, -1)C.glua_pop(L, 1)}if len(res) > 1 {luaCtx.callback <- res} else {luaCtx.callback <- res[0]}close(luaCtx.callback)v.destoryThread(threadId, L)}case C.LUA_YIELD:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "yield"})luaCtx.status = 2v.resumeCount++count := int(C.glua_gettop(L))args := make([]interface{}, count)for {count = int(C.glua_gettop(L))if count == 0 {break}args[count-1] = pullFromLua(L, -1)C.glua_pop(L, 1)}methodName := args[0].(string)if len(args) > 1 {args = args[1:]} else {args = make([]interface{}, 0)}go func() {defer func() {if e := recover(); e != nil {err, ok := e.(error)if !ok {err = errors.New(fmt.Sprintf("%v", e))}luaCtx.act.params = []interface{}{nil, err}}getScheduler().luaCtxQueue <- luaCtx}()method, ok := luaCtx.act.funcs[methodName]if ok {res, err := method(ctx, args...)switch res.(type) {case []interface{}:luaCtx.act.params = append(res.([]interface{}), err)default:luaCtx.act.params = []interface{}{res, err}}} else {res, err := callExternMethod(ctx, methodName, args...)switch res.(type) {case []interface{}:luaCtx.act.params = append(res.([]interface{}), err)default:luaCtx.act.params = []interface{}{res, err}}}}()}default:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "error"})luaCtx.status = 3luaCtx.callback <- errors.New(C.GoString(C.glua_tostring(L, -1)))close(luaCtx.callback)v.destoryThread(threadId, L)}}
}func (v *luaVm) resume(ctx context.Context, luaCtx *luaContext) {metricCounter("glua_vm_run_total", 1, map[string]string{"vm_id": fmt.Sprintf("%d", v.stateId),})metricGauge("glua_vm_memory_size", int64(C.glua_gc(v.state, C.LUA_GCCOUNT, 0)<<10+C.glua_gc(v.state, C.LUA_GCCOUNTB, 0)), map[string]string{"vm_id": fmt.Sprintf("%d", v.stateId),})defer func() {C.glua_gc(v.state, C.LUA_GCCOLLECT, 0)}()v.resumeCount--L := v.threadDic[luaCtx.luaThreadId]pushToLua(L, luaCtx.act.params...)num := C.glua_gettop(L)ret := C.glua_resume(L, num)switch ret {case C.LUA_OK:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "success"})luaCtx.status = 3count := int(C.glua_gettop(L))res := make([]interface{}, count)for {count = int(C.glua_gettop(L))if count == 0 {break}res[count-1] = pullFromLua(L, -1)C.glua_pop(L, 1)}if len(res) > 1 {luaCtx.callback <- res} else {luaCtx.callback <- res[0]}close(luaCtx.callback)v.destoryThread(luaCtx.luaThreadId, L)}case C.LUA_YIELD:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "yield"})v.resumeCount++luaCtx.status = 2count := int(C.glua_gettop(L))args := make([]interface{}, count)for {count = int(C.glua_gettop(L))if count == 0 {break}args[count-1] = pullFromLua(L, -1)C.glua_pop(L, 1)}methodName := args[0].(string)if len(args) > 1 {args = args[1:]} else {args = make([]interface{}, 0)}go func() {defer func() {if e := recover(); e != nil {err, ok := e.(error)if !ok {err = errors.New(fmt.Sprintf("%v", e))}luaCtx.act.params = []interface{}{nil, err}}getScheduler().luaCtxQueue <- luaCtx}()method, ok := luaCtx.act.funcs[methodName]if ok {res, err := method(ctx, args...)switch res.(type) {case []interface{}:luaCtx.act.params = append(res.([]interface{}), err)default:luaCtx.act.params = []interface{}{res, err}}} else {res, err := callExternMethod(ctx, methodName, args...)switch res.(type) {case []interface{}:luaCtx.act.params = append(res.([]interface{}), err)default:luaCtx.act.params = []interface{}{res, err}}}}()}default:{metricCounter("glua_action_result_total", 1, map[string]string{"type": "error"})luaCtx.status = 3luaCtx.callback <- errors.New(C.GoString(C.glua_tostring(L, -1)))close(luaCtx.callback)v.destoryThread(luaCtx.luaThreadId, L)}}
}func (v *luaVm) destoryThread(threadId uintptr, L *C.struct_lua_State) {defer func() {C.glua_gc(v.state, C.LUA_GCCOLLECT, 0)}()cleanDummy(L)delete(v.threadDic, threadId)popThreadContext(threadId)var (index C.intcount C.int)count = C.glua_gettop(v.state)for index = 1; index <= count; index++ {vType := C.glua_type(v.state, index)if vType == C.LUA_TTHREAD {ptr := C.glua_tothread(v.state, index)if ptr == L {C.glua_remove(v.state, index)L = nilreturn}}}
}func (v *luaVm) destory() {C.glua_close(v.state)v.state = nil
}
package libLuaimport ("sync"
)var (globalOpts *Optionslocker     sync.Mutex
)func init() {globalOpts = NewOptions()
}type Metric interface {Counter(name string, value int64, labels map[string]string)Gauge(name string, value int64, labels map[string]string)
}type Options struct {maxVmSize           intpreloadScriptMethod func() stringmetricHandle        Metric
}func NewOptions() *Options {return &Options{maxVmSize: 4,}
}func (opt *Options) WithMaxVMSize(maxVmSize int) *Options {opt.maxVmSize = maxVmSizereturn opt
}func (opt *Options) SetPreloadScripeMethod(method func() string) *Options {opt.preloadScriptMethod = methodreturn opt
}func (opt *Options) SetMetric(handle Metric) *Options {opt.metricHandle = handlereturn opt
}func GlobalOptions(opts *Options) {locker.Lock()defer locker.Unlock()globalOpts = opts
}// metric
func metricCounter(name string, value int64, labels map[string]string) {if globalOpts.metricHandle != nil {globalOpts.metricHandle.Counter(name, value, labels)}
}func metricGauge(name string, value int64, labels map[string]string) {if globalOpts.metricHandle != nil {globalOpts.metricHandle.Gauge(name, value, labels)}
}

添加跨平台支持

六 、编写测试文件

1.go语言文件内容如下:

package mainimport ("context""encoding/json""fmt""time""github.com/xiaodingding/iotfast/library/libLua"
)func test_sum(ctx context.Context, args ...interface{}) (interface{}, error) {sum := 0for _, arg := range args {sum = sum + int(arg.(int64))}if sum%2 == 0 {return sum, nil} else {return nil, fmt.Errorf("bad sum")}
}func json_decode(ctx context.Context, args ...interface{}) (interface{}, error) {raw := args[0].(string)var res map[string]interface{}err := json.Unmarshal([]byte(raw), &res)return res, err
}func main() {fmt.Println("start main")libLua.RegisterExternMethod("json_decode", json_decode)libLua.RegisterExternMethod("test_sum", test_sum)s := time.Now()fmt.Println("time:", s)res, err := libLua.NewAction().WithScript(`function fib(n)if n == 0 thenreturn 0elseif n == 1 thenreturn 1endreturn fib(n-1) + fib(n-2)end`).WithEntrypoint("fib").AddParam(35).Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)s = time.Now()res, err = libLua.NewAction().WithScriptPath("./script.lua").WithEntrypoint("fib").AddParam(35).Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)s = time.Now()res, err = libLua.NewAction().WithScriptPath("./script.lua").WithEntrypoint("fibt").AddParam(35).Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)s = time.Now()res, err = libLua.NewAction().WithScriptPath("./script.lua").WithEntrypoint("test_args").AddParam([]interface{}{69, 56}).Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)s = time.Now()res, err = libLua.NewAction().WithScriptPath("./script.lua").WithEntrypoint("async_json_encode").Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)s = time.Now()res, err = libLua.NewAction().WithScriptPath("./script.lua").WithEntrypoint("test_pull_table").AddParam(69).Execute(context.Background())fmt.Println(time.Now().Sub(s))fmt.Println(res, err)fmt.Println("end main")
}

2.lua语言内容如下:


function fib(n)if n == 0 thenreturn 0elseif n == 1 thenreturn 1endreturn fib(n-1) + fib(n-2)
endfunction fibt(n)return fibc(n, 0, 1)
endfunction fibc(n, a, b)if n == 0 thenreturn aelseif n == 1 then return b endendreturn fibc(n-1, b, a+b)
endfunction test_args(n)res, err = sync_extern_method('test_sum', 1,2,3,4,5,6,n[1],n[2])if err == nil thenreturn reselseerror(err)end
endfunction test_pull_table(obj)return {a=true, b=123, c='hello luajit', d={e=12, f='good golang'}, e={1,2,3,4,4}, 1, m=obj}, nil
endfunction async_json_encode()return coroutine.yield('json_decode', '{"a":"ads","b":12,"c":"sadh"}', 'hello world')
end

3.文件夹内容结构

4.windows下运行测试

Windos测试通过。

5.Linux下运行测试类似于Windows。

lua和go混合调用调试记录支持跨平台(通过C和LuaJit进行实现)相关推荐

  1. 利用 whistle 进行混合开发调试

    介绍 whistle 是一款用 Node 实现的跨平台的 Web 调试代理工具,支持查看修改 http(s).Websocket 连接的请求和响应内容.简而言之就是 Node 版的 Fiddler.C ...

  2. 海思NNIE开发(一):海思Hi3559AV100/Hi3519AV100 NNIE深度学习模块开发与调试记录

    海思NNIE开发系列文章: 海思NNIE开发(一):海思Hi3559AV100/Hi3519AV100 NNIE深度学习模块开发与调试记录 海思NNIE开发(二):FasterRCNN在海思NNIE平 ...

  3. rk3368 Android9.0 HIDL调试记录

    rk3368 Android9.0 HIDL调试记录 Platform: RK3368 OS: Android 9.0 Kernel: 4.4.194 文章目录 rk3368 Android9.0 H ...

  4. Lua 和 C++混合编程

    一.为什么需要Lua 和 C++ 是巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro)里的一个研究小组,由Roberto Ie ...

  5. STM32之QSPI调试记录

    STM32之QSPI调试记录 先声明一下,STM32的QSPI外设同样支持单线模式(兼容普通spi),只是相比普通的spi少了一些特性(比如只支持模式0和3.不能LSB发送等),但是用来操作flash ...

  6. CAN控制器芯片MCP2510调试记录

    CAN控制器芯片MCP2510调试记录 配置CAN内核选项 配置CAN相关的内核选项,将下面几项配置添加到defconfig中: kernel/arch/arm/configs/xxx_defconf ...

  7. ROS上同时预览depth,IR,RGB 调试记录

    ROS上同时预览depth,IR,RGB 调试记录 用rviz同时显示RGB,IR,DEPTH(验证设备:astraprosm,canglong2,deeyea) 1.编译libuvc库 cd lib ...

  8. ML之回归预测:利用十(xgboost,10-1)种机器学习算法对无人驾驶汽车系统参数(2017年的data,18+2)进行回归预测值VS真实值——bug调试记录

    ML之回归预测:利用十(xgboost,10-1)种机器学习算法对无人驾驶汽车系统参数(2017年的data,18+2)进行回归预测值VS真实值--bug调试记录 目录 输出结果 1.增加XGBR算法 ...

  9. Xilinx AXI Crossbar相关调试记录

    Xilinx AXI Crossbar相关调试记录 本文记录在使用Xilinx AXI Crossbar IPcore现象 ** AXI Crossbar IPcore设置如下** 使用AXI Cro ...

最新文章

  1. Spring AOP是什么?你都拿它做什么?
  2. sis防屏蔽程序_弱电工程屏蔽机房设计方案
  3. 反编译apk文件教程(查看java代码篇)
  4. 判断图有无环_判断无向图/有向图中是否存在环
  5. 宝塔命令号操作全-最实用的莫过于修改密码啦
  6. 前端学习(1655):前端系列实战课程之浏览器类型监测
  7. linux 网络设备 安装,Linux_Linux系统配置网络详解,一.安装和配置网络设备- phpStudy...
  8. php+数组存放文件名_php将数组存储为文本文件的三种方法
  9. 车联网发展对汽车经销商的影响
  10. win8计算机用户名在哪里设置,windows8系统用户名微软ID和管理员账户概念详解
  11. 判断一个文件是否可以使用
  12. JS 简易的计算器
  13. 云-PC-matlab-物联网及其它
  14. Hive教程(02)- Hive安装
  15. 【中国互联网江湖30年历史】再无风清扬,再有少年郎
  16. 数仓(一)简介数仓,OLTP和OLAP
  17. python使用matplotlib绘图 -- barChart
  18. 怎样保护计算机桌面不被更改,电脑保护屏幕怎么设置
  19. DataV实现大屏滚动含后端代码
  20. java项目word转换成pdf并且去除水印

热门文章

  1. 如何恢复win10小便签中误删的重要信息
  2. 科技对我们生活有哪些影响?未来科技的发展趋势是什么?
  3. 条形码打印 EPL命令解释
  4. 《iOS开发完全上手——使用iOS 7和Xcode 5开发移动与平板应用》之Objective-C新手训练营
  5. error: variable has incomplete type ‘QApplication‘ 错误解决
  6. Iframe框架+table布局 +div布局实例
  7. 京东金融java面试题_互联网金融西部联盟
  8. 排查解决 - Linux无法访问百度(公网)?
  9. 铲雪车(snow) UVA10203 Snow Clearing 题解 优化版
  10. 高中计算机学考什么时候,江苏高考 | 2019 年高中学业水平考试和信息技术考试时间出炉!...