记录G2G项目中遇到的问题

定时器,让1s发送多次信息


 /*Timer timer = new Timer();
                timer.scheduleAtFixedRate(new TimerTask(){
                    private int count=0;

                    @RequiresApi(api = Build.VERSION_CODES.O)
                    public void run(){

                        this.count++;
                        sendMessage(count);
                        if(count==100)
                        {
                            timer.cancel();
                        }
                        //System.out.println("任务3开始执行了--");
                    }
                }, 0, 10);*/

rabbitmq环境配置

1、首先要下载erlang,然后下载rabbitmq.
2、python下载pika包,Java修改配置文件
遇到的坑:首先是erlang和rabbitmq版本不匹配,这个参考官网进行搭配。
然后是如果发现不匹配想进行重装,卸载erlang卸载不掉,empd进行任务管理器找不到,可以在资源监控中找到。

异步SelectConnection进行消费

import pika

class Consumer(object):
    def __init__(self,username,password):
        self.channel = None
        self.username = username
        self.password = password

    def on_connected(self,connection):
        connection.channel(on_open_callback=self.on_channel_open)

    def on_channel_open(self,new_channel):
        self.channel = new_channel
        self.channel.queue_declare(queue="hello")
        self.channel.basic_consume('hello', self.on_Message,False)


    def on_Message(self,channel, method, header, body):
        print(body)

    def receiveMessage(self):
        auth = pika.PlainCredentials(self.username, self.password)
        parameters = pika.ConnectionParameters(host='localhost', port=5672, virtual_host='/a', credentials=auth)
        connection = pika.SelectConnection(parameters, self.on_connected)
        return connection


C = Consumer('aaa', 'bbb')
connection = C.receiveMessage()
connection.ioloop.start()

mediapipe进行视频和摄像头闪退

 private static final String TAG = "MainActivity";

  private Hands hands;
  // Run the pipeline and the model inference on GPU or CPU.
  private static final boolean RUN_ON_GPU = true;

需要将这个参数改为true

Pyside6报错

重装并添加环境变量

Pyside6闪退

pyside6的6.4版本不对,要选择6.20版本

传送数据为双手导致分割字符串失败


可以看到红线位置出错
修改发送设置,只让发送右手

修改发送设置后,在手移动的过程中还是会发生错误,出现发送两只手的错误

无法更改这个问题,只能将手的数量设置为1,或者在服务端进行字符串设置将21个之后的进行消除

巨坑无比,传送双手时莫名其妙切割错误

mediapipe的问题,它有时会传送2只右手或2只左手或3只手的情况,都要做个处理,否则就会报错

增加一个按钮,可以暂停传输,但是再次开启时会没有反应

 private void setupStopCamera() {
    Button stopCameraButton = findViewById(R.id.button_stop_camera);
    stopCameraButton.setOnClickListener(
            v-> {
              sendStopMessage();
            });
  }
  private void sendStopMessage() {
    String con="fzx\n"+"stopCamera";
    Thread thread=new Thread() {
      @Override
      public void run() {
        sendMessage(con);
      }
    };
    thread.start();
    stopCurrentPipeline();
    this.inputSource = InputSource.UNKNOWN;
  }

这里要把inputSource设置为未知

设置之后会发生闪退,确定问题出在stopcurrentpipe上

private void stopCurrentPipeline() {
    if (cameraInput != null) {
      cameraInput.setNewFrameListener(null);
      cameraInput.close();
    }
    if (videoInput != null) {
      videoInput.setNewFrameListener(null);
      videoInput.close();
    }
    if (glSurfaceView != null) {
      glSurfaceView.setVisibility(View.GONE);
    }
    if (hands != null) {
      hands.close();
    }
  }

因为再次开启时会先执行上述函数,搞不清楚为啥有这个错误,粗暴的解决方法是在开启时不运行这个函数

playsound播放声音失败,提示不能识别命令

将playsound版本降为1.2.2

运行mediapipe官方的手势识别模块,显示windows无法读取文件

这个官方也没有解决,更改mediapipe版本为0.9.1.0(此版本无py3.7,改为3.9)。然后
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
好的,您可以按照以下步骤在Vue3.0项目搭建g2plot: 1. 安装g2plot和@antv/data-set依赖: ``` npm install @antv/g2plot @antv/data-set --save ``` 2. 在需要使用g2plot的组件引入g2plot和@antv/data-set: ``` import { defineComponent } from 'vue'; import { Chart, Line, Point } from '@antv/g2plot'; import DataSet from '@antv/data-set'; export default defineComponent({ ... }); ``` 3. 在mounted钩子函数创建图表并渲染: ``` import { defineComponent } from 'vue'; import { Chart, Line, Point } from '@antv/g2plot'; import DataSet from '@antv/data-set'; export default defineComponent({ mounted() { // 创建数据集 const data = [ { year: '1991', value: 3 }, { year: '1992', value: 4 }, { year: '1993', value: 3.5 }, { year: '1994', value: 5 }, { year: '1995', value: 4.9 }, { year: '1996', value: 6 }, { year: '1997', value: 7 }, { year: '1998', value: 9 }, { year: '1999', value: 13 }, ]; const ds = new DataSet(); const dv = ds.createView().source(data); dv.transform({ type: 'fold', fields: ['value'], key: 'type', value: 'value', }); // 创建图表 const chart = new Chart({ container: 'chart-container', // 指定容器 autoFit: true, height: 500, padding: [40, 40, 40, 40], }); chart.data(dv.rows); chart.scale({ year: { range: [0, 1], }, value: { min: 0, nice: true, }, }); chart.tooltip({ shared: true, showMarkers: false, }); chart.axis('value', { label: { formatter: (val) => { return `${val}亿`; }, }, }); chart.line().position('year*value').color('type'); chart.point().position('year*value').color('type').shape('circle'); chart.render(); }, }); ``` 4. 在模板添加容器: ``` <template> <div id="chart-container"></div> </template> ``` 这样就搭建好了g2plot在Vue3.0项目的环境,您可以根据需要修改图表的类型、样式等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值