Go to advanced search

by papous
Thu Mar 15, 2018 3:46 pm
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Re: Odd Camjam engine behaviour

OK, I solved it. This is for anyone that may have similar issues. It is not the hardware. It is the software and specifically the combination of Flask (its debugger) and threading. If you run the debugger ( export FLASK_DEBUG=1 ) it spawns it own thread. This - at least in my code- interrupts the ma...
by papous
Thu Mar 08, 2018 6:12 am
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Re: Odd Camjam engine behaviour

Thanks again for taking the time to look at the project I will take your advice and look at the code again. I did notice that running just the 'motor' module the engines work fine. So it must be software. I also found this about the RPi.GPIO module: Note that this module is unsuitable for real-time ...
by papous
Wed Mar 07, 2018 12:52 pm
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Re: Odd Camjam engine behaviour

One more thing that I feel it is important: There is a serious voltage drop on the engine terminals when the engines behave erratically. Maybe this is a clue
Frank
by papous
Wed Mar 07, 2018 12:37 pm
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Re: Odd Camjam engine behaviour

Thank you again for the speedy reply.
I managed to create a github account (https://github.com/fsofras) and upload everything there including a readme fle with some help.
For a video, it will take a couple of days.
If I can do something else please ask.
All the best
Frank
by papous
Tue Mar 06, 2018 9:05 pm
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Re: Odd Camjam engine behaviour

Dear Mike, Thank you for this very quick reply. The 'motor' library (code below) is basically a function to move the motors according to the duty cycle. Using sqlite3 was the only way to get the response returned from the Flask to other program sections. This was suggested to me in this post: https:...
by papous
Tue Mar 06, 2018 12:00 pm
Forum: Automation, sensing and robotics
Topic: Odd Camjam engine behaviour
Replies: 11
Views: 1949

Odd Camjam engine behaviour

I return to my previous post https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=201657&p=1255442#p1254804 The problem of the engines running erratically persists and I never did get a proper answer. My questions today are: 1.Could it be due to poor voltage(I am using the 4 battery box with rech...
by papous
Sun Feb 18, 2018 6:29 pm
Forum: Troubleshooting
Topic: can not connect to my pi3
Replies: 2
Views: 360

Re: can not connect to my pi3

Many thanks for your reply
As I said, I knew it was going to happen but...
Anyway, I solved it by connecting a monitor and keyboard to the pi
Thank you again
by papous
Thu Feb 15, 2018 12:52 pm
Forum: Troubleshooting
Topic: can not connect to my pi3
Replies: 2
Views: 360

can not connect to my pi3

Hello all I thought that this was going to happen and I did not take the appropriate backup... So, I was trying to create a access point and was following instructions found in this forum. This did not work so I tried following different instructions and then different ones. Now although my phone de...
by papous
Mon Feb 12, 2018 7:58 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

I was wrong about the dictionary object. It does not work
Sorry...
by papous
Sun Feb 11, 2018 7:25 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

paddyg, after a few days of abstinence from python, I thought you might be interested inn this: Another way of shifting values around is to use the dictionary object which by its nature is a global object. So, you can store key-value pairs in it and retrieve them very easily from anywhere in the cod...
by papous
Sat Feb 03, 2018 6:10 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

Thanks for following up. I did try to use mmap but as you said, a) it needs a physical file to read and write and b) I could not move the file contents around functions. I also tried StringIO, that reads and writes a string buffer ( https://docs.python.org/2/library/stringio.html ) but I had no joy ...
by papous
Thu Feb 01, 2018 5:56 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

I am sorry about this.This line
t = threading.Thread(target=loop_func())
should have been
t = threading.Thread(target=loop_func)
That is what stopped the program working
by papous
Wed Jan 31, 2018 9:42 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

Well, here I am again The code below was working fine until yesterday from flask import Flask,render_template, url_for, request, redirect, session import os.path from time import sleep import motor import distance import threading from myfunc import read_write_file read_write_file('w+','SS') tdist=[...
by papous
Sun Jan 28, 2018 11:57 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

thanks for the tip. I'll a go at it myself
by papous
Fri Jan 26, 2018 5:37 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

Well, I did try using a file read/write method and I am happy to report that it does work.
I will though take your advice and use an sqlite in memory DB which I used before.
Your help and advice has been greatly appreciated. Especially the threading solution
Thank you
by papous
Thu Jan 25, 2018 7:42 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

Thank you paddyg. Good comic.
I'll try to go down that road and let you know.
Just out of curiosity, why use a DB like sqlite and not use a text file to store a couple of values?
by papous
Wed Jan 24, 2018 10:03 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

thank you so much for the help understanding how the code should be written Unfortunately this way of doing things (using session) as well as using Flask.g for storing values does not seem to work. The error that I get on both occasions is RuntimeError: Working outside of request context This typica...
by papous
Tue Jan 23, 2018 8:26 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

I tried to conform to paddyg 's suggestions, so here is a very cut down code from flask import Flask,render_template, url_for, request, redirect, session from time import sleep import motor import distance tdist=[] app=Flask(__name__) app.secret_key = 'You Will Never Guess' @app.route('/') def index...
by papous
Mon Jan 22, 2018 12:20 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Re: Robot web control and distance sensor working in parallel

Thank you paddyg for the very quick reply and your input.
I will try to effect the changes suggested and report back
Frank
by papous
Mon Jan 22, 2018 7:25 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2963

Robot web control and distance sensor working in parallel

I built a robot that is controlled from a web app (using flask). The robot has a distance sensor. The object of the exercise is: while the robot is “driven", if an object is detected, it should stop. Basically it should listen to the web form all the time so it can detect the keypress and also check...
by papous
Mon Jan 15, 2018 6:33 pm
Forum: Python
Topic: Raspberry LX terminal odd behaviour
Replies: 3
Views: 634

Re: Raspberry LX terminal odd behaviour

Dave thanks so much for your reply. It actually worked. I even reduced the sleep period to 1 and it is ok It sounds though that the engines 'initiate' at the point of pwmMotorAForwards.start(0) pwmMotorABackwards.start(0) pwmMotorBForwards.start(0) pwmMotorBBackwards.start(0) That's no problem but d...
by papous
Sat Jan 13, 2018 7:43 pm
Forum: Python
Topic: Raspberry LX terminal odd behaviour
Replies: 3
Views: 634

Raspberry LX terminal odd behaviour

Below there is a fairly simple module to move the two engines that came with Camjam edukit#3. When run from the Thonny platform it works ok. When run fron thw LX terminal or IDLE the engines run erratically, stopping and turning back and forward for about 5 secbefore they resume a (almost) normal op...
by papous
Thu Jan 11, 2018 7:22 pm
Forum: Automation, sensing and robotics
Topic: CamJam engine erratic behaviour
Replies: 8
Views: 1344

Re: CamJam engine erratic behaviour

Back on the same subject, I am using a new set of batteries with ~6V. The engine behaviour remains the same. Here is peculiar thing however: If I run a module 'motors' code below taken from CamJam EduKit 3) the engines run at the same speed without any problems. If I call a function from module 'mot...
by papous
Mon Jan 08, 2018 9:30 pm
Forum: Python
Topic: Help with code weirdness
Replies: 3
Views: 523

Re: Help with code weirdness

solved it
removing try: loop makes the thing work

Thanks

Go to advanced search