The following warnings occurred:
Warning [2] Creating default object from empty value - Line: 11 - File: inc/plugins/tapatalk.php PHP 7.4.10 (Linux)
File Line Function
/inc/plugins/tapatalk.php 11 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 233 pluginSystem->load
/global.php 18 require_once
/showthread.php 28 require_once





Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dyne's Treadwell
#47
I've also been experimenting with the tank drive mixing on my radio, since I know I'll need it later.  The radio supports up to 60 different models (i.e. vehicles, droids, etc.) ... more with an SD Card IIRC.  

I know this will be old hat to some, but I haven't done it in the R/C world before (though I did my own implementation in Shadow for Artie Deco), and thought the explanation might be helpful.  So here's the inputs page of my Treadwell model:

[Image: 10ncd5O.jpg]

Don't worry about the names of the inputs too much, I simply used an R/C plane model as a starting point.  For our purposes, just know that in this setup that Input 4 (Aileron) is the right stick's horizontal axis, and Input 2 (Elevator) is the right stick's vertical axis.  I will call these RX and RY respectively.

Input 1 (Rudder) and Input 3 (Throttle) are the equivalents for the left stick, which I will be using to control Treadwell's head.  They are LX and LY.


As you can see, I have three lines each for the RX and RY inputs, which correspond to the three positions (Up, Down, and Center) of Switch B, one of the toggle switches on the radio.  I'm using this switch to alter the maximum speed of the drive system.

Currently, all three RX lines are identical; I've been experimenting and haven't decided how I want to handle them at different speeds yet (see the end of the post for thoughts), so the switch position doesn't actually matter for this input.  There's just a consistent 50% scale on the RX axis for now.  The switch is only really affecting the three RY lines, and what those lines mean is this:
  • If the switch is flipped in one direction, then give the mixer 25% of the right stick's true vertical value (for a slower than normal speed).
  • If the switch is centered, then feed the mixer 50% of the true value of the right stick's vertical position.  This is what you'd typically use for a tank mix, so it's the "Normal" speed.
  • If the switch is flipped in the opposite direction, then give the mixer the true value of the right stick's vertical axis (for a faster than normal speed).

I'm setting the numbers on the input page because I have three speeds.  If you weren't using a speed control switch like this, then you could just as easily leave all inputs at 100 and use 50 in the mixer settings below.  But because there are 3 "switch" lines per input like you see above, if I put the scaling in the mixer then I'd need 6 lines per input to do the same job (each input has to affect the left track and the right track, so 3 switch values * 2 tracks).

You can see the effect of my toggle switch by the number being returned for channel 1 (left track) and channel 2 (right track) in the images below.  In all three images, the right stick is at full forward (Center Top), and the droid would be moving forward at one of its three maximum speeds.

[Image: VAYaf4H.png] [Image: 8UfvGv9.png] [Image: NY8KbC7.png]

Moving the stick to the Center Bottom would simply make both numbers negative, and the droid would go backward instead of forward.


For the steering, we'll need to look more at the mixer settings:

[Image: djP4Tfi.jpg]

The lines for Channel 3 and Channel 4 above simply connect the lefthand stick to the outputs that control the head.  (I'll have to set limits on the tilt servo - LY - later down the road.)

If you'll notice, both lines have the text "Slow: (U2:D2)".  This is not a complaint about some weird U2-D2 knockoff droid being slow.  U2 means that when the value goes up (U), then instead of instantly changing to the new value, the output will take 2 seconds to reach it from wherever it was.  D2 means the same when the value goes down (D).  The idea is to make the head smoothly accelerate and decelerate rather than instantly starting and stopping, similar to what James Bruton is doing in this video.

I also have similar slowing factor on the drive channels because I don't want Treadwell popping wheelies or charging to full speed instantly.  Both are problems I've had with Artie Deco when I accidentally hit the turbo button while driving.


The pairs of lines shown for Channel 1 and Channel 2 are what actually translate a single stick control input into a tank drive output.


To summarize how the mixer calculates the output, remember that the physical position of the sticks feed the named inputs (Elevator, Aileron, etc.) with values between plus or minus 100%, with the center stick being 0, and left or down being negative.

On the input page, those numbers get scaled.  RY will be Elevator (vertical axis), but scaled to a percentage based on Switch B.  RX will be half the Aileron (horizontal axis).

For the left track (Ch. 1), the output value from the mixer is RY + RX
For the right track (Ch. 2), the output value from the mixer is RY - RX

Note: Any output result beyond the range of plus or minus 100% will be clamped at that limit (So 100% + 100% = 100% output, not 200%).  This is why tank mixing typically starts with the inputs scaled down to 50%.


For example, assume the right stick is neither up nor down.  The RY input is therefore 0% regardless of the speed switch, because 0 times anything is 0.  If you then move the stick all the way to the left (-100%), then you are telling the droid to rotate on the spot by turning to its left.  Since the stick is at -100% horizontal, and this is being halved on the input page, RX equals -50%.

If RY is 0 and RX is -50, then channel 1 returns their sum, -50.  The left track goes backwards at half speed.  Channel 2, meanwhile, is SUBTRACTING the RX value.  0 - (-50) equals 0 + 50, which equals +50.  The right track goes FORWARDS at half speed.  The droid is now rotating on the spot.  

And when the stick is Left Center position, that is exactly what happens, as the image below shows.

[Image: Lb1pWot.png]

The signs of the numbers would be swapped if the stick was instead in the Right Center position, and Treadwell would rotate in the opposite direction.


So what if the stick were left top instead?  Stick returns -100 horizontal, 100 vertical.  With switch B centered, both numbers get halved.  RX = -50, RY = 50.  So channel 1 is 50 + (-50) = 0.  Ch. 2 is 50 - (-50) = 100.  Droid turns left but in a wider circle.

With the other Switch B settings, RY becomes either 25 or 100, giving outputs of either -25/75 or 50/150 (clamped to 100).

If you look closely, you'll notice that the difference in channel 1 & 2 when the horizontal axis is at full throw is always 100 (more accurately, always twice the maximum RX).  This makes sense.  The same RX is being added to one and subtracted from the other.

This suggests that if I alter the RX scale factors, I might want it below 50 in both slow mode (so it turns slower overall) AND in fast mode (since Treadwell should turn more gradually)

With RX scaled to 25% in either mode, and stick in top left as before, we get outputs of 0/50 in Slow and 75/125 (clamped to 100) in Fast.

That's not without quirks, however.  Full left gives us -25/25 in either mode.  It feels odd that spinning in place is slower in fast mode than in normal mode (-50/50).  This is why I'm still debating the RX scales.

Maybe I should just have a fast mode line in mixer that exaggerates the turn rate as RY decreases.  Hm.
Reply


Messages In This Thread
Dyne's Treadwell - by Dyne - 02-24-2017, 08:12 PM
RE: Dyne's Treadwell - by savagecreature - 02-25-2017, 02:43 PM
RE: Dyne's Treadwell - by kresty - 02-25-2017, 09:14 PM
RE: Dyne's Treadwell - by Dyne - 02-25-2017, 11:42 PM
RE: Dyne's Treadwell - by Dyne - 02-27-2017, 06:23 AM
RE: Dyne's Treadwell - by savagecreature - 02-27-2017, 08:32 PM
RE: Dyne's Treadwell - by kresty - 02-27-2017, 09:44 PM
RE: Dyne's Treadwell - by Dyne - 02-27-2017, 11:35 PM
RE: Dyne's Treadwell - by kresty - 02-28-2017, 11:13 PM
RE: Dyne's Treadwell - by Dyne - 02-28-2017, 09:54 PM
RE: Dyne's Treadwell - by Dyne - 02-28-2017, 11:28 PM
RE: Dyne's Treadwell - by Dyne - 03-02-2017, 03:50 PM
RE: Dyne's Treadwell - by Dyne - 03-07-2017, 09:51 PM
RE: Dyne's Treadwell - by Dyne - 03-20-2017, 08:14 AM
RE: Dyne's Treadwell - by kresty - 03-20-2017, 08:42 AM
RE: Dyne's Treadwell - by Dyne - 04-25-2017, 04:12 PM
RE: Dyne's Treadwell - by kresty - 04-25-2017, 04:59 PM
RE: Dyne's Treadwell - by Dyne - 04-25-2017, 06:05 PM
RE: Dyne's Treadwell - by kresty - 04-25-2017, 06:20 PM
RE: Dyne's Treadwell - by Dyne - 09-09-2017, 03:12 PM
RE: Dyne's Treadwell - by kresty - 09-09-2017, 06:27 PM
RE: Dyne's Treadwell - by Dyne - 09-11-2017, 11:28 AM
RE: Dyne's Treadwell - by savagecreature - 09-13-2017, 06:53 AM
RE: Dyne's Treadwell - by Dyne - 09-15-2017, 03:43 PM
RE: Dyne's Treadwell - by Dyne - 09-17-2017, 10:00 PM
RE: Dyne's Treadwell - by savagecreature - 09-18-2017, 06:21 AM
RE: Dyne's Treadwell - by Dyne - 09-18-2017, 06:21 PM
RE: Dyne's Treadwell - by savagecreature - 09-18-2017, 06:35 PM
RE: Dyne's Treadwell - by Dyne - 09-18-2017, 07:03 PM
RE: Dyne's Treadwell - by Dyne - 09-19-2017, 07:09 PM
RE: Dyne's Treadwell - by Dyne - 09-24-2017, 11:01 AM
RE: Dyne's Treadwell - by Dyne - 09-08-2018, 04:07 PM
RE: Dyne's Treadwell - by Dyne - 09-13-2018, 05:03 PM
Dyne's Treadwell - by Dyne - 10-02-2019, 12:29 AM
RE: Dyne's Treadwell - by savagecreature - 10-04-2019, 07:49 AM
RE: Dyne's Treadwell - by Dyne - 10-04-2019, 02:53 PM
RE: Dyne's Treadwell - by Dyne - 05-07-2020, 08:18 AM
RE: Dyne's Treadwell - by kresty - 05-07-2020, 08:58 AM
RE: Dyne's Treadwell - by Dyne - 05-07-2020, 03:39 PM
RE: Dyne's Treadwell - by kresty - 05-07-2020, 03:57 PM
RE: Dyne's Treadwell - by Dyne - 05-08-2020, 04:31 AM
RE: Dyne's Treadwell - by savagecreature - 05-09-2020, 10:59 AM
RE: Dyne's Treadwell - by Dyne - 09-18-2021, 02:59 PM
RE: Dyne's Treadwell - by savagecreature - 09-23-2021, 11:17 AM
Dyne's Treadwell - by Dyne - 09-23-2021, 11:30 AM
RE: Dyne's Treadwell - by Dyne - 09-24-2021, 11:37 PM
RE: Dyne's Treadwell - by Dyne - 09-25-2021, 10:40 AM
RE: Dyne's Treadwell - by savagecreature - 09-28-2021, 08:27 PM
RE: Dyne's Treadwell - by Dyne - 09-29-2021, 06:28 PM
RE: Dyne's Treadwell - by Dyne - 10-21-2021, 11:06 PM
Dyne's Treadwell - by Jaffa007 - 05-31-2022, 02:50 AM
RE: Dyne's Treadwell - by Dyne - 05-31-2022, 10:30 AM
RE: Dyne's Treadwell - by savagecreature - 05-31-2022, 12:27 PM
RE: Dyne's Treadwell - by kresty - 05-31-2022, 02:00 PM
Dyne's Treadwell - by Dyne - 05-31-2022, 03:08 PM

Forum Jump:


Users browsing this thread: 20 Guest(s)