r-cute / rcute-cozmars-server

firmware for Cozmars robot
44 stars 19 forks source link

v2 clean install not starting #24

Closed GaborDA closed 2 years ago

GaborDA commented 3 years ago

Hey again,

I did a fresh install on v2 but unfortunately it is not starting up. When executing sudo python3 -m rcute_cozmars_server i get the following error:

[2021-03-04 09:52:58 +0000] [738] [INFO] Goin' Fast @ http://0.0.0.0:80
[2021-03-04 09:52:58 +0000] [738] [ERROR] Experienced exception while trying to serve
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/sanic/app.py", line 1094, in run
    serve(**server_settings)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 888, in serve
    trigger_events(before_start, loop)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 696, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 48, in before_server_start
    cozmars_rpc_server = CozmarsServer()
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/cozmars_server.py", line 72, in __init__
    self.env = json.load(ef)
  File "/usr/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 105)
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 172, in <module>
    app.run(host="0.0.0.0", port=80, debug=False)
  File "/usr/local/lib/python3.7/dist-packages/sanic/app.py", line 1094, in run
    serve(**server_settings)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 888, in serve
    trigger_events(before_start, loop)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 696, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 48, in before_server_start
    cozmars_rpc_server = CozmarsServer()
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/cozmars_server.py", line 72, in __init__
    self.env = json.load(ef)
  File "/usr/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 105)
Exception ignored in: <function CozmarsServer.__del__ at 0xb55ff738>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/cozmars_server.py", line 65, in __del__
    self.button.close()
AttributeError: 'CozmarsServer' object has no attribute 'button'
sys:1: RuntimeWarning: coroutine 'Loop.create_server' was never awaited

Any idea on what could be wrong?

Cheers

hyansuper commented 3 years ago

sorry, delete the last comma in file ~/.cozmars/env.json.

caidejee commented 3 years ago

I have the similar problem, I also I did a fresh install on v2 but unfortunately it is also not starting up, mine has a different error message.

sudo python3 -m rcute_cozmars_server [2021-09-30 22:41:54 +0800] [1051] [INFO] Goin' Fast @ http://0.0.0.0:80 [2021-09-30 22:41:59 +0800] [1051] [ERROR] Unable to start server Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 556, in serve http_server = loop.run_until_complete(server_coroutine) File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete File "uvloop/loop.pyx", line 1775, in create_server OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 80): address already in use [2021-09-30 22:41:59 +0800] [1051] [INFO] Server Stopped Task was destroyed but it is pending! task: <Task pending coro=<dim_screen() running at /usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/main.py:14> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb6486050>()]> cb=[_chain_future.._call_set_state() at /usr/lib/python3.7/asyncio/futures.py:355]>

hope you can help me tnx

hyansuper commented 3 years ago

@caidejee The error says the address is already in use. Maybe you have other program using the port. Make sure cozmars.service is not running sudo systemctl stop cozmars.service Then try again

caidejee commented 3 years ago

ahh forgot to update it was an error on my part, forgot to restart hehehe btw I think I finally got it to install, since I can access the web application test/wifi/motor/servo thanks for this project :)

todayjt commented 2 years ago

你好,之前链接成功了。但有一天碰到了哪根线,导致屏幕显示链接参数后还是会持续阶段性的显示。但网址却链接不上。

hyansuper commented 2 years ago

这是一个很费精力的机器人,跟批量生产的玩具还是很不同的。提别是出了硬件问题的时候。要不直接把屏幕的电源线解掉,如果能链接上,那可能是屏幕的问题 @todayjt

todayjt commented 2 years ago

是的,确实好费脑子哈哈。现在可以正常开机链接上网站,但通过网站上的测试功能全部失灵。用电脑链接可以链接上,但输入行动代码,毫无反应!因为您的这个项目,我一直在自学python,但坑太深。还希望多多帮助指点!

hyansuper commented 2 years ago

可以用树莓派依次连接各个硬件进行测试,这样学习曲线不那么陡,用python控制,控制硬件的库 https://github.com/r-cute/rcute-cozmars-server/blob/master/requirements.txt 前四个 @todayjt

todayjt commented 2 years ago

嗯,自己乱研究浪费了很多时间,现在正在按你说的这种办法来学习。但还请帮忙分析下我的情况,因为之前整体运行过,没问题,甚至可以进行控制编程,虽然像RGB灯没能实现,但其他功能运行无误; 在一次不知是不是哪短路了的情况后,我尝试了用两张内存卡,重做系统重新按教程安装库等,尝试了4至5次。两张卡依旧只能进行到,能登录上网页,但在网页端和pc端控制都毫无反应的情况。开机正常,喇叭能哒一声,屏幕也正常显示。能帮忙分析下,这应该是硬件方面出现问题可能性大些,还是树莓派上的软件设置问题大些? 现在已经测试了gpiozero.Robot:运行前进后退等没问题。舵机也进行了测试没问题。按理说,这些东西没问题。在网页上控制这些功能应该没问题啊,但有什么可能性导致他在能链接网页。很困扰;

todayjt commented 2 years ago

[2021-11-19 18:25:41 +0000] [695] [INFO] Goin' Fast @ http://0.0.0.0:80 [2021-11-19 18:25:46 +0000] [695] [INFO] Starting worker [695] [2021-11-19 18:26:12 +0000] - (sanic.access)[INFO][10.0.0.75:55381]: GET http://rcute-cozmars-3444.local/test 200 2857 [2021-11-19 18:26:15 +0000] [695] [INFO] connection open [2021-11-19 18:26:18 +0000] [695] [ERROR] Exception occurred while handling uri: 'ws://rcute-cozmars-3444.local/rpc' Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/sanic/app.py", line 891, in _websocket_handler await fut File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/main.py", line 83, in rpc await RPCServer(ws, cozmars_rpc_server).run() File "/usr/local/lib/python3.7/dist-packages/wsmprpc/server.py", line 27, in run async for data in self.ws: TypeError: 'async for' requires an object with aiter method, got WebsocketImplProtocol [2021-11-19 18:26:18 +0000] - (sanic.access)[INFO][10.0.0.75:55381]: GET http://rcute-cozmars-3444.local/about 200 109

^C[2021-11-19 18:27:19 +0000] [695] [INFO] Stopping worker [695] [2021-11-19 18:27:19 +0000] [695] [INFO] Server Stopped

hyansuper commented 2 years ago

不知是python还是sanic模块版本的问题,改一下就好了 @todayjt https://github.com/r-cute/rcute-cozmars-server/issues/32#issuecomment-962545741

todayjt commented 2 years ago

超级感谢!困扰了半个月,终于又恢复了他!超级感谢!