mayuanjason / Building-Jetbot-From-Scratch

Building Jetbot from scratch
32 stars 9 forks source link

Remote cotrol works no lag, but Collision Avoidance didn't and lag #4

Open RyanC1681 opened 5 years ago

RyanC1681 commented 5 years ago

Hi, that is nice video. I tried to use separate USB power for motor as yours JetBot. Remote control did work with no lag, However, the live_demo for Collision Avoidance - Variable "prob_blocked" mostly > 0.9, camera output lag and my JetBot keep 360 spin, not forward. Any idea how to fix it? Thanks,

RyanC1681 commented 5 years ago

mbot2 didn't show blue/yellow control, but Max Linear/Rotation Spd bar only. Anything missing? Thanks,

mayuanjason commented 5 years ago

Hi RyanC1681,

KineticJs is no longer maintained and it doesn't work well on Chrome. Please try following methods:

  1. Try other browsers.
  2. Forget mbot2 brother... I just update a new GUI named mbot3, try it, I think you will like it...
mayuanjason commented 5 years ago

Hi RyanC1681,

For the first questions. Yes, I met the same issue weeks ago. I put Jetbot on the glass and prob_blocked always > 0.9, so I guess maybe the shadow reflected on the glass affected the camera, then I spread a sheet to the glass and Jetbot works well. Also, you can raise a new issue to Nvidia official Websit for help.

RyanC1681 commented 5 years ago

Hi, I tried mbot3 that did have better UI, but it got error as below: with known good camera. How should I fix it? Thanks,

Starting camera thread. Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:521 No cameras available 192.168.100.175 - - [30/Jun/2019 22:12:12] "GET / HTTP/1.1" 200 -

RyanC1681 commented 5 years ago

Never mind, I figured out that was power issue. Thanks,

mayuanjason commented 5 years ago

Hi RyanC1681,

Good news. BTW, you can also run mbot programs on laptop or PC with USB camera on it, since camera_opencv.py supports most USB webcams and laptop cameras. Just comments below lines:

diff --git a/mbot3/app.py b/mbot3/app.py
index 5febd45..51228f7 100644
--- a/mbot3/app.py
+++ b/mbot3/app.py
@@ -30,7 +30,7 @@ except FileExistsError:

 app = Flask(__name__)

-robot = Robot()
+# robot = Robot()

 @app.route('/')
@@ -43,17 +43,7 @@ def teleop():
     opcode = request.args.get('opcode', 'stop')
     speed = float(request.args.get('speed', 0.8))

-    if opcode == 'forward':
-        robot.forward(speed)
-    elif opcode == 'backward':
-        robot.backward(speed)
-    elif opcode == 'left':
-        robot.left(speed)
-    elif opcode == 'right':
-        robot.right(speed)
-    elif opcode == 'stop':
-        robot.stop()
-
+    
     return '', 204

and run # CAMERA=opencv python3 app.py