Rover 3.5 dev on Pixracer for Balance Bot

I have 3.5 dev on my Pixracer and finally got wheel encoders working. I set pwm count to 2 and used pins 345and 6 for aux to connect the encoders. In mission planer I can select status and read them as rpm1 and rpm2. I am using a Pololu Trex Jr. motor controller and have the pwm input on ch 1&2. I can drive the wheels in both direction and turn seems to be working. At this point I can see a small pwm input from the gyros as it will not try to balance. maybe the pwm loop is too slow. anybody have ideas on this issue. Also what modes are available on this rev.

1 Like

Hi Jdunkle,

My most recent set of changes for Balance Bot haven’t gone in yet but hopefully they’ll go in later this week.

You’ve set the FRAME_CLASS to 3? There’s a couple of other suggestions for parameters on this page.

The balance bot wiki pages will get some updating soon-ish. They’re a little out of date now…

Thanks Randy I changed the par. config to the setup you pointed out. I am using Manual mode is this correct ? and what modes are supported currently. both encoders read correctly + foreword and - reverse but the wheels are not responding correctly so I will check the motor polarity on this motor board as they turn opposite directions. Also in Servo output on mission planer position 3 and ch 4 are set to motor 3 and 4 respectively. is this correct.?
Once I get this configured and wired correctly I will post that info here.

Jack

SERVO1_FUNCTION = 73 (Throttle left)
SERVO3_FUNCTION = 74 (Throttle right)
FRAME_CLASS = 3 (Balance Bot)
SCHED_LOOP_RATE = 200 (Scheduler loop frequency)
MOT_SLEWRATE = 0 (Do not account for motor slew)
FS_CRASH_CHECK = 1 (Enable Crash Checks)

ATC_BAL_P = 1.6 (increment by 0.01)
ATC_BAL_I = 1.4 (increment by 0.01)
ATC_BAL_D = 0.04 (increment by 0.001)

It should be setup like a “skid steering” vehicle. Normally the left and right motor’s ESCs are connected to the flight controller’s MAINOUT1 and MAINOUT3.

Theoretically all modes should work but I think MANUAL is the best to start it with.

The AHRS_ORIENT may also need to be changed if the flight controller is pointing up or down.

I’ve created a reference-frame page for the ArduRoller (Jason Short’s design for a balance bot).

In case others see this and wonder why their wheel encoders work - there
are several ways they can mysteriously not work.

In particular, BRD_PWM_COUNT and RELAY_PIN (and RELAY_PIN2) can easily
stuff you up.

This is the cheat-sheet I was using for testing (probably incomplete as I
was flashing between vehicles during testing which would have been
resetting parameters to defaults):

Peter my wheel enc. Work great and in the correct direction, however I have worked all weekend on trying to get the wheel motors to oporate correctly. It seems it is doing some kind of a mix maybe from the AP or maybe it’s somthing going on with the motor board. I’m using the polula Jr trex. It has a mix function but I have it turned off as the AP should be doing the mix left and right wheel. Also when I change angle forword and back word it drives the motors but not allot not even close for ballencing.
I am going to conect survos to ch1 and ch2 and see if the AP is sending the corect PWM.
Jack

Discourse ate this list because I included something that it mistook for a
signature break…

RPM testing:

param set WENC_TYPE 0
param set WENC2_TYPE 0
param set BRD_PWM_COUNT 0
param set RELAY_PIN -1
param set RELAY_PIN2 -1
param set RSSI_TYPE 0
param set RPM_TYPE 2
param set RPM_PIN 54
param set RPM2_TYPE 2
param set RPM2_PIN 53
reboot

For wheel encoding:

param set BRD_PWM_COUNT 0
param set RELAY_PIN -1
param set RELAY_PIN2 -1
param set RSSI_TYPE 0
param set RPM_TYPE 0
param set RPM2_TYPE 0
param set WENC_TYPE 1
param fetch
param set WENC2_TYPE 1
param set WENC_PINB 54
param set WENC_PINA 53
param set WENC2_PINB 52
param set WENC2_PINA 51
reboot
graph RPM.rpm1 RPM.rpm2

Winch testing (Copter):
param set WINCH_ENABLE 1
param set BRD_PWM_COUNT 0
param set RSSI_TYPE 0
param set RELAY_PIN -1
param set RELAY_PIN2 -1
param set RPM_TYPE 0
param set RPM2_TYPE 0
param set WENC_TYPE 1
param set WENC2_TYPE 0
param set WENC_PINB 54
param set WENC_PINA 53
param set SERVO8_FUNCTION 88
graph SERVO_OUTPUT_RAW.servo8_raw
long DO_WINCH 0 1 1 0.1

for RSSI testing:
param set RSSI_TYPE 4
param fetch
param set RSSI_ANA_PIN 55
param set BRD_PWM_COUNT 0
param set RELAY_PIN -1
param set RELAY_PIN2 -1
graph RC_CHANNELS.rssi
reboot
arm safetyoff

Peter Barker | Programmer,Sysadmin,Geek.
pbarker@barker.dropbear.id.au | You need a bigger hammer.
:: It’s a hack! Expect underscores! - Nigel Williams

Randy still having problems with balance bot on pix racer. Tried allot if different things set your perameters and now I have,no pwm out. Motors will not,run at all. I will have,to figure out what happened there hope the pwm output mux didn’t take a dump. Any idea when your going to release 3.6
Jack

Jack,

Maybe post a dataflash log or a param file and we can look for errors… the motors should move unless the MOT_PWM_TYPE or the SERVOx_FUNCTION values have been set incorrectly.

Copter-3.6 is getting close to the official release, within a month I’d say.

Rover-3.5 will probably go into beta in a few weeks. I’d like to get basic Sailboat support included if possible (along with balance bot).

Randy all perameters were correct and motors were running I was changing directions and changed the motor control board thinking maybe somthing wrong with that board and I could never make the motors turn again even changing back to the original motor control board there is no pwm out. I’ll run some test on the pixracer and try to see what’s going on. The motor control board works fine. Is the 3.5 dev from mega planer have your latest changes or do I need to get the latest somware else.

Jack,

The “latest” Rover-3.5-dev should include all the balance bot changes…

Randy I erased and reloaded 3.5 dev started form scratch with parameters and now all is well with motor pwm out. encoders are well and in motor test the motors turn in the correct direction and right and left motors are correct. Not shure what happened with code but the pixracer works again.Having issues tuning motors seem to want to accel to fast and I think I found the issue. I used a spare set of motors from when I built my older ballbot from Jasons design. they were 6v motors and I see you use 12v version. I think this could be the issue so I have ordered the 12v motors and will see how that works. What do you think about the motor issue, is there a way to tune forew the 6v or is changing to the 12v motors a good idea.

Jack

1 Like

Jack,

I think it should be possible to tune it to use the lower voltage motors. It will probably be the ATC_BAL_* parameters that need tuning but we haven’t yet documented the procedure so for the moment I think it’ll be a bit of trial and error to get it tuned properly. Certainly as part of the Rover-3.5 beta testing and official release we will need to finish off the balance bot wiki pages.

Randy
I finally got the ball bot to drive around still need some running but it works now. I used the same frame (Jason’s frame) motor controller and motors you chose. Wondering if you could share your parameter files from that rover so I could do a comparison. Any news on 3.5 beta release.
Thanks Jack

Also Randy is there a way for the bot to disarm the motors when it falls over. Currently when it falls the motors go full and it takes off and crashes into whatever is in the way. On my other bot with Jasons code when it sees about 30 deg it disarms the motors and when you pick it back up to 0 or level it rearms.
Any thoughts