BrickPi Firmware Update Help


#1

Hi again. Sorry for being forced to post my problems again…

Recently after many attempts I managed to update brickPi software to 2.5 version with the help of @JohnC and team.
Then I went on with my main project which is segway type robot. Basic idea is to frequently, or even constantly fetch gyro sensor data, process it in PID controller or something similar and compensate deviation with motors.

BrickPiUpdateValues() is big multipurpose method. Not only it turns the motors but also fetches data from sensors. This behavior is not acceptable in my case. I can’t constantly check sensor data and distort it by turning motor in uncontrolled way.

Going through BrickPi.py I found motorRotateDegree()… ‘Hurrays’ lasted couple seconds. This method turns motor without an end.

I visited this forum and found similar posts about motorRotateDegree. I updated BrickPipy few times and it didn’t help. Other solution could be rewrite whole file, add more methods… I don’t have time for that and the knowledge. So my prof allowed for simpler project. Simple robot - car with basic steering. Like your simplebot.
‘Hurray’?? well no…

I went on your github, downloaded simplebot_simple, uploaded on my rpi and ran it. Here is the manual on how to steer, taken from comments:

# Commands:
#	w-Move forward
#	a-Move left
#	d-Move right
#	s-Move back
#	x-Stop

Facing brickPi with motor ports B anc C turned to me I got motor B on the right and C on the left. Here are what commands do in my case:

# Commands:
#	w-motor B turns forward ( to stop i need to type s and hit enter) 
#	a-motor c turns forwart (to stop I need to type d and hit enter)
#	d-does nothing 
#	s-does nothing 
#	x-both motors turn backwards, faster than single one.
#	ctrl+c quits program but if motors were running they continue to run
#	if a is pressed first both motors run forward

I even don’t know where to start debugging.

I use pycharm for python dev. I use python 2.7.6 interpreter on rpi. But the same results are when I acces rpi via putty or ubuntu on windows…


#2

http://forum.dexterindustries.com/t/brickpi-python-code-help-solved-completely-this-time/2158/15


#3

You mean this?:
http://forum.dexterindustries.com/t/would-like-to-improve-motor-encoder-readings-from-python/1914/5?u=mike2060

Will try it tomorrow then. But still. what about getting data from sensor without turning motors?


#4

I don’t think that the version of BrickPi.py I’m working on (& haven’t posted anywhere) would help here.
Looking at the simplebot simple code - it intends to start the motors going in a direction till you change the direction, or tell it to stop.
Why the keys/motors are cross wired is puzzling - the program is very straightforward.


#5

It is and thats why I chose it. To be simple enough not to break…So if it is example project why it doesn’t work? I don’t trust myself enough to say if firmware update was success. Might that be the root of the problems? Or should I rewrite BrickPi.py ?


#6

I’ve re-written the firmware several times using an AVR programmer. It works well (it verifies everything written). You have to keep close track of the error messages.
I don’t think BrickPi is causing you problems. I wouldn’t re-write it (mostly it works fine). The version I’m working on is (I think) finer, but not ready for prime time. Also I’m using a Raspberry Pi 3 so my timing is bound to be different.

Arduino 1 controls motors A & B, as well as sensors 1 & 2. I’d try moving both motors to the same Arduino (try each Arduino) & change the simple code appropriately. Maybe one Arduino’s hardware/firmware is munged, but the other isn’t.


#7

The code you mentioned is also performing weirdly. I am attaching it here because links went dead in original post. In my case, unmodified code first turns both motors a bit forward and then only one motor is turning continuously backward.
After setting degree to from -68000 to 360 motors first turn approx 120 deg and then one turns continuously the other way.
LEGO-Multi_Motor_Encoder_Test-ABK.py (12.3 KB)


#8

Ok, I finally gave up brickpi.py and so on and moved with ev3dev. I managed to recreate browserbot there using your example. I think ev3dev has a better developed motor class. Im still failing with gyro sensor but now at least I got something to show my professors.