NEW RELEASE: Roboteq CANbus and analog hardware and software

Power wheelchair board for REAL info!

POWERCHAIR MENU! www.wheelchairdriver.com/powerchair-stuff.htm

NEW RELEASE: Roboteq CANbus and analog hardware and software

Postby LROBBINS » 11 Nov 2018, 12:31

I have just posted a new release of the CANbus system for Roboteq as well as the analog-only script at https://drive.google.com/open?id=0B3svXvyPGRgral9FU2lJZlpHdFU. There are a number of significant improvements since the last release and I've tried to make the Manual more complete.

CONTENTS

WHY BUILD YOUR OWN CONTROL SYSTEM? 2
OVERVIEW 3
DRIVING THE WHEELCHAIR 6
SYSTEM DESIGN
I. System Modules 9
II. Software Design 12
III. Some Suggestions for Tuning User Settings 26
IV. Hardware 28

Although the bulk of the Manual covers the CANbus system, much of the software description is relevant for the analog version as well. In particular, whether using one version or the other I do recommend reading the Roboteq MOTOR CONTROLLER subsection (beginning on p. 21) of "Software Design" as well as "Some Suggestions for Tuning User Settings" (starting at p. 26).

Please note that the CANbus version of the Roboteq script has been real-world tested and is in daily use in Rachi's chair, but that the analog version of the Roboteq script has only been bench tested with dummy loads. If you use the analog version of the Roboteq script, PLEASE BE CAREFUL, and, of course, post back your results. The user settings in in the release for both the CANbus and analog systems are not the ones actually in Rachi's chair, but more conservative ones for safety's sake.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 11 Nov 2018, 16:05

A note about the most recent changes in programming.

The most intractable problem I've had to deal with on Rachi's chair is the problem of starting a turn-in-place with casters that carry 30% (or more when tilted) of the weight. As John has already said, too low motor compensation was a big part of the problem. Increasing it to the point of jerkiness helped, but not enough, and, of course, that's not a pleasant way to drive a chair.

So, I lowered motor resistance to where driving was comfortable and added some code to boost motor compensation when turning at low power - the boost decreases as power increases (ending at 10% total power). Again, this helped a lot to give a snappy turn-in-place once the turn had started, but left another problem - I still had to move the stick too far left or right to get the casters to "unstick". The latest program solves this too.

I think that the source of the problem is this. Imagine that maximum speed is 100% (= 1000 Roboteq command value), but that maximum turn rate is just 20%. It takes a motor command of >50 Roboteq units to get these motors to barely start turning. For going forward or backwards that's just a stick 5% beyond the deadband (0.05*1000 = 50); in other words you start to move as soon as the stick is off center. But for turn in place, moving the stick that much wont do anything (0.05*1000*0.2 = 10) and the stick has to be moved left or right five times more, to >25% throw (0.25*1000*0.2 = 50). It's hard to know if you've moved the stick exactly 1/4 throw - move it a smidgen too little and the turn doesn't start, move it a bit more and the turn starts, but a smidgen too far and the turn may be too fast for maneuvering in a tight space. A clear symptom of this is that if the stick is just moved off center left or right the contactor clicks in, but the chair doesn't start to turn until the stick is moved quite a bit more and its hard to know how much more to move it. When going forward and back, however, the chair starts to move as soon as the contactor clicks. We want to get the same response for turning as for going forward and back; the chair should start to move as soon as the stick is off center.

To do this, I've added one more user setting (MinimumSteering). The logic is illustrated in the following simplified code (simplified by leaving out stuff that gets the sign right for forward vs. backward, left vs. right):
Code: Select all
  IF ((TotalM1+M2MotorCommands <= MinimumSteering) AND (Steering > 0) AND (Steering < (MinimumSteering-Throttle))) THEN
    Steering = MinimumSteering-Throttle
  END IF

This doesn't do anything unless both total motor command and Steering are low. If they are, it resets Steering from its low value to a higher value. That higher value isn't a fixed MinimumSteering, but (MinimumSteering-Throttle) because Throttle above 0 will also get the motors moving. In Rachele's chair MinimumSteering = 50 isn't enough, but setting MinimumSteering = 100 does the trick. (In the actual program, MinimumSteering can be set between 0 and 20, and the program multiplies this by ten; finer gradations are useless.)

I'm happy, and so are the volunteers who load her onto a van each weekday morning - no more wild swings as they get the chair lined up.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 11 Nov 2018, 16:47

In case the above isn't clear, here's a graph of what happens making a right turn while not going forward or back.
MinSteer.JPG
The solid lines show what this code does. As soon as the stick is moved a bit right, the motors go to 10% power and stay there until the stick is moved past 25% throw and the turn rate then keeps increasing with further stick throw until it reaches its maximum of 20%. The dotted blue line shows a possible improvement not yet in the code.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby Burgerman » 11 Nov 2018, 17:13

But that boost will still be in place while also unstuck. Wont it?

So isn't it better to increase motor compensation instead at quite low speed only until "unstuck" if needed? Thats what the "torque" setting does on the R-Net programmer. Although it really needs to be on the turn axis only in your case?
User avatar
Burgerman
Site Admin
 
Posts: 65050
Joined: 27 May 2008, 21:24
Location: United Kingdom

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 11 Nov 2018, 18:39

Yes, that boosted steering command will be in place even after unstuck, but it just gives constant minimum turn rate (+ motor compensation) from stick barely off center until at ca. 25% of throw (effectively falling as motor current drops off, however). This is not needed because of load of the casters, but because of the internal friction of the motor and gearcase and tires that impose a minimum pwm to get movement and the different stick movements needed to get to that minimum in pure turn vs. fore-aft or combined maneuvers. That's why CompTurnBoost (which does what you've described) does give a good, smooth response from 25% throw to full steer, but doesn't solve the problem of having to move the stick well off center to get turn-only movement started in the first place.

This is only evident in turn and not speed because the joystick is scaled over 0 to TurnRate (0-to e.g. 190 with pot at max in Rachi's chair) for left-right stick and 0 to Speed (0 to 1000 with pot at max) for fore-aft stick - 5X more sensitive in speed than in turn. An alternative to the crude way I did it might be to use exponential scaling of Steering when steering and power are low switching to linear scaling once power exceeds MinimumSteering. It would be more complicated, but would make things proportionate in that interval between barely off center and 25% of throw. I think I'd rather program things to follow that dotted curve in the graph - also proportionate between minimal throw and 25%, but I don't see an easy way to program that either. When you have yourself and the BM3 back in operation I hope you'll tell me whether it's worth the effort to make turn in place proportionate between 0 and 25% stick.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby Burgerman » 11 Nov 2018, 19:12

I assure you it is. I use just 5 or 6mm when correcting path for eg. Just enough to break out of dead band. Esp at speed. However, that added shove it needs for turn in place isn't wanted in straight line travel, and so it will then feel odd as you make supposed tiny corrections in a straight line as it stands. You dont feel this because you are not going very fast mostly.

And because the motor compensation is slow to react on rachis chair (higher impedance motors mean you need to wait a longer time for the higher pulse width to be reached). Made worse than in my own case because I like turn acceleration to be pretty much instantaneous. So turn compensation works faster for 2 separate reasons on my chair. I might add that it reaches 100A per motor at around 15% of turn stick. With compensation set correctly. And thats with a dead band of around 5%.
User avatar
Burgerman
Site Admin
 
Posts: 65050
Joined: 27 May 2008, 21:24
Location: United Kingdom

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 11 Nov 2018, 20:16

that added shove it needs for turn in place isn't wanted in straight line travel, and so it will then feel odd as you make supposed tiny corrections in a straight line as it stands
NO, this increased turn stick sensitivity is only there if not moving forward or back - it is active only during turn-in-place. Turn sensitivity is unaffected if the chair is either moving forward or back or once the steering value is above the "unstick" point. (An aside, I too have deadband at 5%.)

Now, an "ah duh" moment. I realized that it is actually trivially easy to get the "dotted line" proportional behavior during turn in place. In arduino, there's even a function called "map" that does exactly what I want. If total command is less than MinimumSteer, this does the job for right turn in place:
Code: Select all
Steering = map (Steering,0,1000,MinimumSteering-abs(Throttle),1000);
and almost the same for left turn in place. Works very smoothly, even with MinimumSteering reduced from 100 to 70.

The map function doesn't exist in MicroBasic, but the equation needed to code it manually is actually pretty simple.

I'll do this for the analog script as well, and edit the release download within the next hour. So, you should download them again in a bit.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 11 Nov 2018, 20:41

GoogleDrive updated with the proportional turn-in-place change.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 12 Nov 2018, 09:15

TYPO

The analog script I put on GoogleDrive yesterday has a type. Line 497 should say -1000 and not -100. I will correct the uploaded file, but if you've already downloaded it is probably easier to just fix that line.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby Burgerman » 12 Nov 2018, 10:02

Not yet.
User avatar
Burgerman
Site Admin
 
Posts: 65050
Joined: 27 May 2008, 21:24
Location: United Kingdom

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 19 Nov 2018, 20:09

MINOR UPDATE

Ensuring that minimal stick movement in turn would start the chair moving markedly improved control feel, so I decided to see if this is useful for Throttle as well as Steering. It doesn't make any real difference if maximum speed is set near 100%, but at very low speed pot settings the stick has to be moved a bit past deadband before the chair will move. Re-mapping throttle gets rid of that as well, so no matter what direction you move or what the speed pot is set to the chair will start to move as soon as the stick is off center. I've uploaded this revision, and a re-worded manual and changed the setting name from MinimumSteering to MinimumStick. Rachi's chair needs a value of 7 (5 would be enough for Throttle and 8 might be better for Steering, but not wanting to add another variable I just compromised on 7), John's BM3 will probably need no more than 3, and maybe even less, and the Mobot probably should be set at 0.

I wonder if this won't improve the driving experience for a chair that has tilt or lift actuator inhibits. Maybe those "turtle" settings are annoying not just because they are slow, but because you can't know with any precision how far you need to move the stick to get the chair to start to do anything.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby Burgerman » 19 Nov 2018, 20:46

Well you say that, but I dont find that unless motor compensation is set too low. The correct amount is quite critical to work right.

In R-Net, and others, theres a setting called torque, which does much the same as your new command. But it does so with added load compensation at very small stick movements, rather than adding a "fixed" amount of power addition at low command rates. And I suspect that this will work better as it gives a consistent response and is load sensitive. For eg it gives a similar movement/acceleration response facing an uphill slope when crossing a road, as facing down. Or turns the "same" when on a smooth polished floor as on a thick carpet. It also helps more on turning than forward movement. As load is higher. So you wont need more for turns.
User avatar
Burgerman
Site Admin
 
Posts: 65050
Joined: 27 May 2008, 21:24
Location: United Kingdom

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 19 Nov 2018, 23:24

RNet's torque is probably the same as my CompTurnBoost which is already in the script, and yes, it helps get a turn-in-place going once the motor has enough PWM to start turning at all. MinimumStick acts only in the situation where the chair will not move at small stick movements because of the fact that there's a minimum PWM needed to start any motor moving even in a no load situation. It is not a fixed additional amount, it is a starting amount that disappears proportionately once the chair is actually moving (in any direction). When you get the BM3 back up and running, here's a test to do after you get MotorCompensation (and CompTurnBoost if needed) about where you like it.

Set MinimumStick to 0 and set SpeedPotFwdMin to 10 or even less and TurnPotForwardMIn to 10 or less. Set the physical pot at minimum. Now move the stick forward the tiniest bit off center. Move the stick the tiniest bit to one side (Deadband = 5 is only 0.5% PWM - i.e. 5 out of 1000, the stick is just a hair off center - approx 0.2o of stick movement.) . Does the chair move or do you have to move the stick a little further before it goes? If the latter, set MinimumStick to 1 and try it. Does this reduce the minimum stick displacement needed to get movement? Keep increasing MinimumStick until just barely moving the stick makes the chair move.

On Rachi's chair I have a nice audible indication of when Deadband is reached - the contactor clicks. (With your latching relay you don't have that, but you could attach a voltmeter to one motor so it will show >0 as soon as Deadband is reached.) With MinimumStick = 0, if I move the stick just till I get the click the motor doesn't move AT ALL, does not even buzz at all - it doesn't even try to move. (Pot settings have to be low enough to "see" this - otherwise it's easy to go past deadband enough to start the motors moving without even feeling it.) There's almost no current flowing and hence motor compensation does naught - if Speed or Turn are low enough, I have to move the stick a few degrees past Deadband before the motor starts to move. With MinimumStick at 7, as soon as I hear the click, the motors start to turn - very slowly as they should with minimum stick. As the stick is moved further, or as motor compensation increases PWM, this effect of MinimumStick disappears. The stick feel is exactly the same whether the pot is at a ridiculously low minimum or at SpeedPot(forward or reverse)Max and TurnPot(forward or reverse)Max. Consistent and predictable.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby Burgerman » 19 Nov 2018, 23:55

Up and down a slight gradient?

It is not a fixed additional amount, it is a starting amount that disappears proportionately once the chair is actually moving (in any direction).


Because its harder to start it moving against a gradient. And easier with that gradient. I understand what you are saying but still think it will behave differently even at super slow speeds. Will test when I get to it! I wonder if you are needing this because you are no longer using current sensors externally.
User avatar
Burgerman
Site Admin
 
Posts: 65050
Joined: 27 May 2008, 21:24
Location: United Kingdom

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 20 Nov 2018, 09:17

(1) I am using current sensors. Having figured out how to detect a sensor failure, I put them back a long time ago.

(2)
Because its harder to start it moving against a gradient.
No, it disappears because it's programmed to disappear.

But, you are right, the real test will come when you try it. If you don't like it just set MinimumStick to 0 and tell me I have my head up my a--. I'm quite used to making mistakes and I won't be insulted.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby eugenech » 22 Nov 2018, 19:27

Hi Lenny,
I will try it in a next couple of weeks and let you know how it works.

Eugene
eugenech
 
Posts: 25
Joined: 20 Feb 2017, 19:26
Location: Richmond Hill, Ontario

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 26 Nov 2018, 21:03

I now have two people testing the analog version of the script, and both have found some problems. I will continue to update the file at GoogleDrive, so do check for new versions before starting to use it. (It will be stored there with the same release number as everything except the analog version seems to be stable and without problems.) The link is: https://drive.google.com/open?id=0B3svXvyPGRgral9FU2lJZlpHdFU
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 28 Nov 2018, 18:37

One of the problems with the analog script has been fixed. There was a mistake in my StickSensitivity: subroutine. When I put that code alongside the C++ code with that function of Master's program in the CANbus system, the mistake was pretty clear. The other reported problem has not yet been addressed, but I don't yet know whether it is a script problem, configuration profile problem or possibly even a wiring problem. Awaiting a report on further testing.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 06 Dec 2018, 22:25

NEW RELEASE

The Roboteq script bugs found by two testers, one with brushed and one with brushless motors, have now been thoroughly SQUASHED so a new release has been uploaded to Google Drive. Testing now looks good on three systems: CANbus and brushed motors, analog with brushed motors and analog with brushless motors.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 08 Dec 2018, 13:59

Roboteq has asked that I put the files in a github repository. Here's the link:
https://github.com/LennyRobbins/CANbus-Wheelchair-Controller
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy

Re: NEW RELEASE: Roboteq CANbus and analog hardware and soft

Postby LROBBINS » 31 Jan 2019, 20:57

I've just made a couple minor changes to the Master nodule program and uploaded it to https://drive.google.com/open?id=0B3svXvyPGRgral9FU2lJZlpHdFU. I am finding learning how to use Github a PITA, so I'd prefer that you always check google drive for updates.

The two changes were these:
(1) There was a deadspot for seat movement at exactly 45o stick. Changing one > to >= fixed this.
(2) I became aware of slightly more snappy chair response when just taken off charge and a slightly more sluggish chair response at the end of the day. Master now uses current voltage (average of 5 reads over at least 15 seconds with no motor activity) to adjust Throttle and Steering before sending them to Roboteq so feel is constant throughout the day.
LROBBINS
 
Posts: 5543
Joined: 27 Aug 2010, 09:36
Location: Siena, Italy


Return to Everything Powerchair

Who is online

Users browsing this forum: Bing [Bot], mrgus2u and 32 guests

cron

 

  eXTReMe Tracker