![robotc remote control code vex robotc remote control code vex](https://slidetodoc.com/presentation_image/25a72c8cc70bf92220c1144453788c18/image-57.jpg)
![robotc remote control code vex robotc remote control code vex](https://s1.manualzz.com/store/data/002004285_1-90d1cbe492c9803c3ec9c96e71b99077-360x466.png)
That makes more sense (to me) if the joystick is providing target motor speeds,Īnd each motor is PIDspeed controlled to the that target. I’ve seen some Holonomic code that finds the maxv = max(abs(motor target values)) and then divides all the motor values by 127/maxv, so they are all in correct proportion while limiting to max 127.
![robotc remote control code vex robotc remote control code vex](https://parobotics.github.io/parallax-curriculum/Programming/Graphics/motors.jpg)
Getting the precise encoder value for each wheel is going to be a pain. Lynfield (aka H aka slide) drive is already a holonomic drive, so not much evolution was necessary. Answering these questions will allow you to add and subtract the correct joystick axis to get the desired result. So ask yourself, if the robot is on the ground, and you move the left joystick up, what do you want each wheel to do? What about if you move the left joystick sideways? What if you move it up and sideways. Just try and think about how you want each wheel to react when you move the joysticks. I don’t want to post “here’s how you do it” code, because nobody learns anything from that. Is your robot moving up and down? Anyway, this can be done with the same method of mapping joystick arithmetic to each wheel. As for the holonomic arcade drive, I don’t understand what you mean by the z-axis. I can be done, just think about how the joystick relates to each wheel. It will make your life much easier, and programming faster, if you map each wheel to a mathematical function of joysticks just like the example code above. For example, if you move forward, moving the right joystick will do nothing as long as the left joystick is about the threshold. However, since everything is in “if else” form, you cannot do more than one behavior at once. Will this work? Is it efficient? How can I make the robot move like the traditional arcade style but without the spin (Use the left joystick for x, y, and z movement) and when I want to spin in place use the right joystick?ĭepending on how you have your motors flipped, the code that you posted should allow you to drive your robot. If((abs(joy_y) > joy_threshold) & (joy_y > 0))Įlse if((abs(joy_y) > joy_threshold) & (joy_y joy_threshold) & (joy_x > 0))Įlse if((abs(joy_x) > joy_threshold) & (joy_x < 0)) the robot.įor my “lynfield drive”, I want to be able to control the left joystick for forwards/backwards and the right joystick for horizontal/spin. Since the motors are on different sides of the robot, you want them doing different things sometimes so that you can turn. If y is 127, and x is -127, then both motors stay still.Īgain, you can fill in the rest of the table. If y is 127, and x is 127, then both motors go forward. If you have the same equation for both motors, then lets look at what would happen: You can fill in the rest of the table using the values 127, 0, and -127 on each of the axis to see what would happen. If y is 127, and x is -127, then the right motor goes forward while the left motor stays still. If y is 127, and x is 127, then the left motor goes forward while the right motor stays still. If y is 127, and x is 0, then both motors go forward. To see why the code provided achieves this behavior, plug in values to test the output. The back and forth motion of the robot is controlled by the y axis of the joystick, and the turning of the robot is controlled by the x axis of the joystick. This code is for the arcade style of driving, where one joystick controls the chassis movement of the robot.