at_nivelungen
Posts: 3
Joined: Thu Mar 16, 2017 2:38 pm

Some errors on using scratchClient with Wedo 2.0

Thu Mar 16, 2017 3:37 pm

Hello, everyone.

Now I'm using ScratchClient (http://heppg.de/ikg/wordpress/?page_id=6), which is Gerhard Hepp's work, with Wedo 2.0 on RPi3, but not working in my environment.

1. Followed 'Quick install procedure' in http://heppg.de/ikg/wordpress/?page_id=6, no problem on all of the steps.
2. Read http://www.heppg.de/ikg/administration/ ... o2_Adapter and installed 'bluepy' by
$ sudo pip install bluepy
That went well.
3. Started Scratch 1.4 on my Rpi3 and typed the following command in the terminal to pair the RPi3 with Wedo 2.0:
$ sudo python src/scratchClient.py -c config_wedo2_complete.xml
Then, displayed
2017-03-16 23:34:44,276 - __main__ - INFO - Connected to Scratch !
2017-03-16 23:34:44,278 - adapter.wedo2Adapter - WARNING - wedo2: Press 'connect'-Button on Hub
so pressed the button on Wedo 2.0 hub, then displayed
2017-03-16 23:34:49,298 - adapter.wedo2Adapter - WARNING - wedo2: found device a0:e6:f8:fe:ac:40, LPF2 Smart Hub 2 I/O
but occured the following error during turning the LED between blue, red and green on the hub:
2017-03-16 23:34:53,987 - adapter.wedo2Adapter - ERROR - notify_data, no service for port 6
The LED turned green at the end.
4. Without caring the error, tried to operator the motor on Wedo 2.0 by operating 'motor power 100' and 'motor on' on scratch software, but nothing happened.
Then, displayed the following errors:
2017-03-17 00:31:03,768 - adapter.wedo2Adapter - ERROR - motion, data not parsed 04 02 00 00 00 40 03 2d 7a b4 42
2017-03-17 00:31:14,216 - adapter.wedo2Adapter - ERROR - motion, data not parsed 04 02 00 00 80 40 03 2d 7a b4 42
The motor and the motion were connected to Port1 and Port2 on the hub, respectively.
I didn't modify 'config_wedo2_complete.xml'.
I downloaded scratchClient.tar.gz on March 6th, so it's the newest version.
The OS version of my RPi3 is as follows:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
I googled about this error, but didn't find any helpful information.
I really appreciate if you'd advise me on this error.

Thanks,

ghp
Posts: 1156
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Some errors on using scratchClient with Wedo 2.0

Thu Mar 16, 2017 7:04 pm

Hello,
thank you for this very detailed feedback. I will look into this.
Looks as if the connection, service lookup and first commands for the RGB look fine. The color cycle red-green-blue-... is initiated by the adapter code, so basic commands are working.
More info soon.
Regards,
Gerhard

ghp
Posts: 1156
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Some errors on using scratchClient with Wedo 2.0

Thu Mar 16, 2017 10:38 pm

Hello,
some research on this topic shows:

WARNING - wedo2: Press 'connect'-Button on Hub
changed this to INFO.

WARNING - wedo2: found device a0:e6:f8:fe:ac:40, LPF2 Smart Hub 2 I/O
changed this to INFO

ERROR - notify_data, no service for port 6
Caused by an internal race condition. Port 6 is RGB LED, where the service is not yet registered while a data message is already received. Find this on my machine too, sometimes.

ERROR - motion, data not parsed 04 02 00 00 00 40 03 2d 7a b4 42
This should not happen. The motion sensor (distance, count) sends data in default mode which is unexpected. But this should just be ignored.

The motor problem is strange. Works in my environment, with one or two motors connected.
Here I need your help.

I have updated the wedo-adapter with additional debug messages also for firmware version from hub. (and some cosmetic changes in wedo2_sample.sb).
Please download from my website to get this version.

The config_wedo2_complete.xml is fine. There is a scratch script for tests in scratchClient/scratch/wedo2/wedo2_sample.sb
In the script, press green flag and navigate to motor. In 'complete'-mode, the motor1 or motor2 should work.

Please do a test run on your machine:
- Start scratch with test script. Confirm Network dialog and press green flag.
- Disconnect all sensor or motor from lego hub
- start scratchClient in debug mode ( add a '-d' to command line) and redirect output to a log file ( > log.txt 2&>1).

Code: Select all

cd ~/scratchClient
sudo python src/scratchClient.py -c config_wedo2_complete.xml -d  > log.txt 2&>1
- enable hub and wait till color led has changed to green
- connect motor to any port.
- in the scratch script, navigate to motor page and place slider for motor1, motor2 to max.
- when you press the green button on hub, the pages in scratch script should cycle.
- attach motion sensor, wait some seconds
- stop scratchClient with ctrl-c

Please attach the log file to issue on github https://github.com/heppg/scratchClient/issues/1
or send this to me by mail function of forum.

Regards,
Gerhard

at_nivelungen
Posts: 3
Joined: Thu Mar 16, 2017 2:38 pm

Re: Some errors on using scratchClient with Wedo 2.0

Fri Mar 17, 2017 3:22 pm

Hello Gerhard, thank you very much for your help!!
Please do a test run on your machine:
All right.
I'm away for a while, so I'll be able to report the results three days later at earliest.

Regards,
RK

ghp
Posts: 1156
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Some errors on using scratchClient with Wedo 2.0

Fri Mar 17, 2017 4:05 pm

Hello,
perhaps the problem is in another place: you wrote 'operating 'motor power 100' and 'motor on' '.
With the variables 'motor1' or 'motor2', the speed is controlled. These variables are globel 'for all sprites'. Reasonable values are [-100, +100], values close to zero do not move the motor.
In addition to these variables, there are broadcasts 'motor1_brake' and 'motor1_drift'. The extra signal 'motor1_run' just uses the last speed set.
If in doubt about which variables to use or which broadcasts, use http://localhost:8080/adapters and you get an overview on the inputs/outputs used (scratchClient is started, when scratch connected then html view can accept input/output values or clicks on signals).
Image
Regards,
Gerhard

at_nivelungen
Posts: 3
Joined: Thu Mar 16, 2017 2:38 pm

Re: Some errors on using scratchClient with Wedo 2.0

Mon Mar 20, 2017 1:19 pm

Hello,
perhaps the problem is in another place: you wrote 'operating 'motor power 100' and 'motor on' '.
You're right and I'm very sorry that I didn't read the document of scratchClient so much.
I could control the motor by making 'motor1' variable and changing its value and read the motion sensor value from 'motion2_distance' sensor value.

I'd failed in controlling the motor because I just:
1. Showed some motor blocks ('Edit'->'Show Motor Blocks')
2. Dragged 'motor on' and 'motor power 100' blocks to 'Scripts' area of Split1
3. Then tried to control the motor on Wedo 2.0 by operating them

I found this procedure was wrong by your comment and the document of scratchClient.
I really appreciate your help.

Regards,
RK

ghp
Posts: 1156
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Some errors on using scratchClient with Wedo 2.0

Mon Mar 20, 2017 5:46 pm

Hello,
great that it works now.
But it was a good opportunity to review some of the concepts in the code. And documentation got a new section where motor blocks are discouraged to use with this adapter.
Regards,
Gerhard

higgins91
Posts: 3
Joined: Fri Sep 16, 2016 3:46 pm
Location: France

Re: Some errors on using scratchClient with Wedo 2.0

Sun Nov 26, 2017 3:07 pm

hello all, sorry to bump this post.
I try to use my Wedo 2.0 hub with my RPI3 but when i enter this command:

Code: Select all

sudo python scratchClient -c config_wedo2_complete.xml
i recive this error:

Code: Select all

/usr/bin/python: can't find '__main__' module in 'scratchClient'
i have follow this procedure:
http://heppg.de/ikg/wordpress/?page_id=6
installed 'bluepy' all went well.
RPI3 with pixel up to date.

Code: Select all

No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 8.0 (jessie)
Release:	8.0
Codename:	jessie

thank you for help and sorry for my english :oops:

ghp
Posts: 1156
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Some errors on using scratchClient with Wedo 2.0

Sun Nov 26, 2017 3:33 pm

Hello,
perhaps your command line is wrong ?
instead of

Code: Select all

(wrong)
sudo python scratchClient -c config_wedo2_complete.xml
try using

Code: Select all

cd ~/scratchClient
sudo python scratchClient.py -c config_wedo2_complete.xml
Hope this helps,
Gerhard

higgins91
Posts: 3
Joined: Fri Sep 16, 2016 3:46 pm
Location: France

Re: Some errors on using scratchClient with Wedo 2.0

Sun Nov 26, 2017 3:48 pm

thank you for helping me,
i enter this command

Code: Select all

pi@raspberrypi:~/scratchClient/src $ sudo python scratchClient.py -c config_wedo2_complete.xml
and i arrived to run the scratch wedo2 sample with succes !

many thanks ;)

Return to “Scratch”

Who is online

Users browsing this forum: No registered users and 1 guest