Open Leseratte10 opened 5 years ago
You didn't give me the first lines of the log, so I can't see what versions of libraries you are using.
I did find that OpenCV 4.0.0 has changed the getContours function, and this causes the maps not to be drawn. I pushed a fix for that a couple of days ago.
Also, note line:
[I 2018-12-22 13:22:11,841] MAP: drawing roomba: pos: [375, 725, 425, 775], theta: 90
That shows where the Roomba is being drawn (and which direction it is facing), and it has actual co-ordinates - so it is being updated. the 0,0 is where the text is being drawn.
What version of OpenCV are you using, and when did you install Roomba980?
Nick I am having an issue getting the maps to work. The logs seem to indicate a part of the problem but I am not sure why it's not working. The Roomba folder is owned by openhab with 777 permissions. The script wrote the roomba_map.html file as well as some png files without an issue. When I pull up the maps using a webview in a sitemap, I dont get an image. I just get the little icon that shows up when an image does not exist. The "roomba1map.png" file is not created in the html/roomba folder.
HTTP ERROR 404
Problem accessing /static/roomba/roomba1map.png. Reason:
Not Found
Also see errors below on files missing marked with **
[I 2019-11-26 21:03:05,000] *******************
[I 2019-11-26 21:03:05,004] * Program Started *
[I 2019-11-26 21:03:05,004] *******************
[I 2019-11-26 21:03:05,005] Roomba.py Version: 1.2.1
[I 2019-11-26 21:03:05,005] Python Version: 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]
[I 2019-11-26 21:03:05,006] Paho MQTT Version: 1.5.0
[I 2019-11-26 21:03:05,006] CV Version: 4.1.2
[I 2019-11-26 21:03:05,006] PIL Version: 6.2.1
[I 2019-11-26 21:03:05,007] <CNTRL C> to Exit
[I 2019-11-26 21:03:05,007] Roomba 980 MQTT data Interface
[I 2019-11-26 21:03:05,008] connecting to broker
[I 2019-11-26 21:03:05,009] Creating Roomba object
....
[I 2019-11-26 20:50:01,777] Posting DECODED data
[I 2019-11-26 20:50:01,777] MAP: Maps Enabled
[I 2019-11-26 20:50:01,778] MAP: openening existing line image
[I 2019-11-26 20:50:01,806] MAP: openening existing problems image
[I 2019-11-26 20:50:01,821] MAP: openening existing map no text image
**[W 2019-11-26 20:50:01,821] MAP: map no text image problem: [Errno 2] No such file or directory: '/etc/openhab2/html/roomba/roomba1map_notext.png': set to None
[W 2019-11-26 20:50:01,822] error loading font: cannot open resource, loading default font**
[I 2019-11-26 20:50:01,822] MAP: home_pos: (400,825)
[I 2019-11-26 20:50:01,827] MAP: Initialisation complete
[I 2019-11-26 20:50:01,827] Connecting roomba1
[I 2019-11-26 20:50:01,828] Seting TLS
[I 2019-11-26 20:50:04,194] Roomba Connected roomba1
[I 2019-11-26 20:50:04,198] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"netinfo":{"dhcp":true,"addr":3232242201,"mask":4294967040,"gw":3232242366,"dns1":3232242366,"dns2":0,"bssid":"26:f5:a2:30:6a:ae","sec":4}}}}
[I 2019-11-26 20:50:04,243] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"wifistat":{"wifi":1,"uap":false,"cloud":1}}}}
[I 2019-11-26 20:50:04,246] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"netinfo":{"dhcp":true,"addr":3232242201,"mask":4294967040,"gw":3232242366,"dns1":3232242366,"dns2":0,"bssid":"26:f5:a2:30:6a:ae","sec":4}}}}
[I 2019-11-26 20:50:04,250] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"wlcfg":{"sec":7,"ssid":"50616369666963"}}}}
[I 2019-11-26 20:50:04,252] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"mac":"f0:03:8c:96:23:fc"}}}
[I 2019-11-26 20:50:04,254] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"country": "US"}}}
[I 2019-11-26 20:50:04,254] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"cloudEnv": "prod"}}}
[I 2019-11-26 20:50:04,267] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"svcEndpoints":{"svcDeplId": "v007"}}}}
[I 2019-11-26 20:50:04,360] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"mapUploadAllowed":true}}}
[I 2019-11-26 20:50:05,598] Received Roomba Data roomba1: wifistat, {"state":{"reported":{"localtimeoffset":-300,"utctime":1574819393,"pose":{"theta":0,"point":{"x":100,"y":126}}}}}
[I 2019-11-26 20:50:05,603] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"batPct":100,"dock":{"known":true},"bin":{"present":true,"full":false},"audio":{"active":false}}}}
[I 2019-11-26 20:50:05,606] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"cleanMissionStatus":{"cycle":"quick","phase":"run","expireM":0,"rechrgM":0,"error":0,"notReady":0,"mssnM":3,"sqft":6,"initiator":"localApp","nMssn":756},"language":0,"noAutoPasses":false,"noPP":false,"ecoCharge":false}}}
[I 2019-11-26 20:50:05,612] updated state to: Running
[I 2019-11-26 20:50:05,613] MAP: old x,y: (526, 925) new x,y: (526, 925) theta: 90 roomba pos: [501, 900, 551, 950]
[I 2019-11-26 20:50:05,616] MAP: drawing roomba: pos: [501, 900, 551, 950], theta: 90
[I 2019-11-26 20:50:05,692] MAP: checking room outline
**[W 2019-11-26 20:50:05,692] Unable to load room outline: [Errno 2] No such file or directory: '/etc/openhab2/html/roomba/roomba1room.npy', setting to 0
[I 2019-11-26 20:50:05,692] MAP: openening existing room outline image
[W 2019-11-26 20:50:05,692] MAP: room outline image problem: [Errno 2] No such file or directory:** '/etc/openhab2/html/roomba/roomba1room.png': set to New
[I 2019-11-26 20:50:05,697] Received Roomba Data roomba1: $aws/things/6977840020505760/shadow/update, {"state":{"reported":{"vacHigh":false,"binPause":false,"carpetBoost":true,"openOnly":false,"twoPass":false,"schedHold":false,"lastCommand":{"command":"start","time":1574801196,"initiator":"localApp"}}}}
[I 2019-11-26 20:50:05,699] MAP: received: new_co_ords: {'y': 100, 'x': 126, 'theta': 0} old_co_ords: {'y': 100, 'x': 126, 'theta': 0} phase: run, state: Running
[I 2019-11-26 20:50:05,699] MAP: old x,y: (526, 925) new x,y: (526, 925) theta: 90 roomba pos: [501, 900, 551, 950]
[I 2019-11-26 20:50:05,700] MAP: drawing roomba: pos: [501, 900, 551, 950], theta: 90
[I 2019-11-26 20:50:05,775] MAP: checking room outline
Also I am not sure if it is related but it seems the roomba log stops receiving input after a short while. If I restart the roomba process without doing anything to the roomba itself, it begins sending regular updates for some time and then fails again.
In case you need it , I am running on a ubuntu box with version 18.04 and I installed Roomba980 this week so I should have all the latest files.
Have you tried creating the /etc/openhab2/html/roomba
directory, and making sure it's writable?
Might be a problem with creating that directory.
I'm also running on Ubuntu 18.04, but all my stuff has been in place for a long time, so if a directory was missing/not writable I might miss it.
Yes I have, in fact it created the following files in there roomba1lines.png roomba1problems.png, roomba1roomba_map.html and style.css. I verified the permissions again. I now set the directory owned by root with group of openhab. permissions are set to 777 or read,write, execute for all.
I start the roomba process with a service. This is how I call the script in case it helps.
roomba -n 'roomba1' -b '192.168.1.2' -p '1883' -U 'user' -P 'password' -R '192.168.1.3' -u '6746373465436' -w ':6:2394587:sdtQWwerTrTTGa' -l '/var/log/openhab2/roomba.log' -m -M '/etc/openhab2/html/roomba' -s '(800,1650,0,0,2,180)' -I '/etc/openhab2/icons/classic/'
I also start the roomba with a script, here is mine:
./roomba.py -b 192.168.100.119 -s '(900,1700,-350,-175,-4,0)' -I /etc/openhab2/icons/classic/ -M /etc/openhab2/html/roomba/ -l /home/nick/Scripts/roomba.log
Notice I don't have any '
around the strings. I don't know if that matters or not.
I'm running roomba not installed though, which is why it's ./roomba.py
not roomba
. My roomba settings are in the default config.ini file that should get generated automatically.
I run mine with sudo
as well.
Just looked at my files. There is no roomba1room.png
file the file is actually called room.png
ie no Roomba name at all.
I suggest you try with the Roomba name left off, ie no -R roomba1
. I only have one Roomba, so I have never tried the script with a different Roomba name from the default Roomba
.
or try copying roomba1room.png to room.png
In fact all my files do not have the roomba name in them. ie map.png
etc.
I do have files with the Rooma name in them, but they are old. The new files are all owned by openhab:openhab
It may be useful to enable debug mode -D
and see what the output is, might help.
ok I tried that and it created the problems.png , lines.png, and a roomba_map.html. The html file references the map.png but it doesn't create that for some reason. Do you think I should try the following instead?
git clone https://github.com/NickWaterton/Roomba980-Python.git
cd Roomba980-Python
I performed a pip uninstall on both the user I had previously installed it with, and again with the root user. I then sudo -i and performed the git clone. Then I cd to /Roomba980-Python/roomba
Next I try running the command as ./roomba.py with all my options and it doesn't spit anything out. no error or anything, it just goes to prompt again. permissions look right... I tried a simple roomba -h and it does the same.
Sorry, I though you were installing from git, PyPi doesn't have the latest version on it.
You either still have to install (after git clone
), or run roomba_direct.py
.
To install (from /Roomba980-Python
) run python setup.py install
you might need sudo
.
However for troubleshooting, I reccomend to run roomba_direct.py
from/Roomba980-Python/roomba
with your command line arguments.
roomba.py
is just the class, you can't run it directly.
ok thanks for clearing that up, I am not well versed in python. I gave that a try but I am getting the following error.
No handlers could be found for logger "roomba.main"
[I 2019-11-29 15:46:20,346]
[I 2019-11-29 15:46:20,346] Program Started
[I 2019-11-29 15:46:20,346]
[I 2019-11-29 15:46:20,347] Roomba.py Version: 1.2.6
[I 2019-11-29 15:46:20,347] Python Version: 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]
[I 2019-11-29 15:46:20,347] Paho MQTT Version: 1.5.0
[I 2019-11-29 15:46:20,347] CV Version: 4.1.2
[I 2019-11-29 15:46:20,347] PIL Version: 6.2.1
[I 2019-11-29 15:46:20,348]
The "No handlers could be found..." message, you can ignore, it's just saying that it can't find the class handler for logging messages, won't stop it running, you just don't get a lot of messages (if any).
The map.png
file is created for the first time when the roomba starts vacuuming (I think).
As an alternative you can install it (as I described), and use roomba
to start it (NOT roomba.py
that's different), see if it works then. I still recommend debug mode (-D
) to see what is going on.
Alright good news! I got my first map... It's drawing right now! Thanks for all the help on this. You are right, there is hardly anything in the log but it does seem to be working.
This is pretty much the only thing in the log with the Debug on. Is there any way to make the text on the map a little larger?
[I 2019-11-29 16:37:12,430] PIL Version: 6.2.1
[D 2019-11-29 16:37:12,430] -- DEBUG Mode ON -
[I 2019-11-29 16:37:12,430]
I have pushed a fix for roomba_direct.py
to fix the logging issue.
if you run git pull
it should update it and you'll get more in the logs.
As to font size, I use truetype font FreeMono.ttf
with font size 40 (which is large) by default. If you don't have this font installed, the program will use whatever your default font is (which may be small).
Install FreeMono.ttf
as follows:
sudo apt update
sudo apt install fonts-freefont-ttf
If 40 is still too small (it is large), the font size is configured on line 935 of roomba.py
.
let me know how you get on.
Nick thanks again, looks like both my font and log issues are fixed now! Great work on this by the way. I love all the functionality!
I have just set this up to control my Roomba, but the map thing doesn't seem to work properly.
I started it with the command
$ roomba -R 10.0.xxx.xxx -u xxxxxxxxxxxxxxxx -w ":1:xxxxxxxxxx:xxxxxxxxxxxxxxxx" -b 10.0.xxx.xxx -p 1884 -U xxx -P xxx --drawmap --mapSize "(800,1500,0,0,0,0)" --roomOutline
, and it writes a map.png file and all the HTML files, but that isn't updated.The tool seems to initialize MAP writing:
but then, MAP data is only received when the state of the robot changes:
Also, it always contains the 0,0 coordinate so the robot on the map never moves from its start position. Does th iRobot 895 not support continuous position sending?
EDIT: Even with debug mode
-D
, I don't see map entries in the log file, only when the robot stops or starts, and then only with coordinates 0,0.