Announcement

Collapse
No announcement yet.

MECANUM DRIVE w/ Block Coding... HELP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MECANUM DRIVE w/ Block Coding... HELP

    Hi we are trying to convert our Mecanum drive we have used in our VEX class. We cannot figure out how to create Mecanum drive using the block coding. We are very inexperienced using block coding so any references or example would be a huge help!!! We understand how to set power to a motor based upon a command from the joystick. But with mecanum you need to blend the values from the joystick/s to get the motors to spin in the appropriate directions right? Or are we overthinking it, just give each motor a command based upon a joystick position and that will execute whenever that condition is met?

    Any help or insight would be great. THANK YOU

    Kilabots

  • #2
    Originally posted by kilabots5020 View Post
    Hi we are trying to convert our Mecanum drive we have used in our VEX class. We cannot figure out how to create Mecanum drive using the block coding. We are very inexperienced using block coding so any references or example would be a huge help!!! We understand how to set power to a motor based upon a command from the joystick. But with mecanum you need to blend the values from the joystick/s to get the motors to spin in the appropriate directions right? Or are we overthinking it, just give each motor a command based upon a joystick position and that will execute whenever that condition is met?

    Any help or insight would be great. THANK YOU

    Kilabots
    I'm sure this will be less helpful than more experienced programmers, however, in our experience, we've never gotten mecanums to work on joysticks for both forward/backward AND strafing (side to side) only one or the other. In our current config, we use the joysticks to drive forward/backward (in tank drive) on the Y-axis of the joysticks, and then use a method triggered by a button to strafe right or left.

    It's always made perfect sense to us that you should be able to go forward/backward on the Y-axis and side to side on the X-axis, but in three years we've never gotten it to work.

    Hopefully a more experienced programmer can offer a more logical solution.

    Michael P Clark
    Founding Mentor, FTC 9958
    http://www.redfishrobotics.com
    "We're Hooked on FIRST"

    Comment


    • #3
      There are several good omni/mecanum programming examples out there for Java.

      Perhaps you should consider OnBotJava rather than Blocks.

      Check out the FTC Wiki for a tutorial.
      https://github.com/ftctechnh/ftc_app...-Java-Tutorial

      Comment


      • #4
        Originally posted by kilabots5020 View Post
        Hi we are trying to convert our Mecanum drive we have used in our VEX class. We cannot figure out how to create Mecanum drive using the block coding. We are very inexperienced using block coding so any references or example would be a huge help!!! We understand how to set power to a motor based upon a command from the joystick. But with mecanum you need to blend the values from the joystick/s to get the motors to spin in the appropriate directions right? Or are we overthinking it, just give each motor a command based upon a joystick position and that will execute whenever that condition is met?

        Any help or insight would be great. THANK YOU

        Kilabots
        Kilabots,

        can you post a photo of your mecanum drive setup/robot? I'm pretty sure you can put together a mecanum drive with Blocks (with some help from the FTC community).

        Do you have a copy of your VEX code that you used to drive the mecanum drive? Could you post that somewhere?

        Tom

        Comment


        • #5
          We successfully got our mecanum robot working in Blocks programming using the algorithm posted here: https://www.chiefdelphi.com/forums/s...ad.php?t=84446. One change for the better (our opinion): instead of using the x-axis of the right joystick for strafe, we used the left and right triggers (left triggers is increasing negative x and right trigger increasing positive x). If you are still stuck, we could post our code but the programming is very straightforward without any 'tricks'. Make sure your wheels are in the correct positions! Good luck!
          tank drive mecanum algorithm Technical Discussion

          Comment


          • #6
            More thoughts: that algorithm I mentioned behaves just like a tank drive - so the robot behaves just like a 2 motor robot with the y-axes on left and right joysticks, but with the addition of the trigger buttons to strafe left and right. Very easy to drive! Last year in App Inventor I programmed the mecanum using a single joystick for forwards/backwards on the y-axis, rotations on the x-axis, and strafe on the x-axis of the right joystick. Lots more math in the programming! The robot worked but my head did not - it was harder for me to drive than the current tank drive.

            Comment


            • #7
              Last year, our team used a mecanum drive operated with right stick y for forward/back, right stick x for strafe left/right, and left stick x for rotation. We used java and here is a link to the discussion and source code from our engineering notebook:

              http://team9960.org/mecanum-drive-pr...rive-software/

              This year, we converted the code to Blocks, which took less than an hour. If you need that code, I can post it tomorrow (I am not near the right computer today).

              Comment


              • #8
                gensiphone Yes, please post code for blocks... Thank You!!!

                Comment


                • #9
                  I posted a screen shot of the driveMecanum function I wrote for my mecanum drive robot in Autonomous mode. The screen shot also includes a moveForward function for driving forwards and a Stop function for stopping as examples of use. The 3 variables - Forward, Turn, and Strafe work just like the motor power variables, ie., 1 is full power, 0 is stopped, -1 is reverse. Strafe = 1 moves right; Strafe = -1 moves left.

                  I didn't include the speak functions that are referred to in the moveForward - I use them instead of telemetry for troubleshooting Autonomous - the robot simply speaks out what it is doing as it does it. You can always turn down the volume if you have heard enough :-)

                  Also, be sure to initialize the two motors on the right side of the robot "set motor direction REVERSE" - you will know you did it correctly if all 4 motors drive forwards with Forward = 1.

                  I also posted a screen shot showing the drive portion of my teleop program. You can see the motor power calculations are identical to the Autonomous version. I also added a powerBand variable so you could change the quickness of the robot - be sure to add Telemetry to tell the drive so.

                  Hope this helps!

                  Comment


                  • #10
                    Bummer ... I took the screen shots at high resolution ... 512kb file size each ... but this forum resized the picture at very low resolution. I'm going to try again, this time by attaching the screen shots as files, no resizing done.
                    Attached Files

                    Comment


                    • #11
                      Growl, that didn't work either because the Forum recognized the files as pictures and again auto-sized them to uselessness. I wish this could be fixed by the Forum Moderator.

                      3rd try: post as a ZIP file.... Fail! "Your file of 937kb exceeds the maximum file size of 97.7kb."

                      I don't want to post my entire programs because most of the programs won't work with your robot and team strategies.

                      Comment


                      • #12
                        Ok, I posted the screen shots to my Dropbox - hope this works for you!
                        driveMecanum: https://www.dropbox.com/s/xwcq3tmgu4...canum.png?dl=0
                        teleop Mecanum: https://www.dropbox.com/s/soxsk2qhni...canum.png?dl=0

                        Comment


                        • #13
                          Originally posted by benmcl View Post
                          Ok, I posted the screen shots to my Dropbox - hope this works for you!
                          driveMecanum: https://www.dropbox.com/s/xwcq3tmgu4...canum.png?dl=0
                          teleop Mecanum: https://www.dropbox.com/s/soxsk2qhni...canum.png?dl=0
                          At the top of the first block it has "to driveMechanum with: Forward, Turn, Strafe" How does that get there?

                          Comment


                          • #14
                            Look at the Functions category of the toolbox.
                            Here's a screenshot: https://drive.google.com/file/d/1Fae...ew?usp=sharing

                            ​​​You can create a function block (with or without a return value) and then call it.

                            Comment


                            • #15
                              Robokats 11130 Kokomo has got mecanum to work in blocks

                              Comment

                              Working...
                              X