RobotMesh Coding Issue

Hi, everyone
I am wondering when I compile the program in Robot Mesh Blockly. It shows error Client-specified read timeout exceeded Can anyone gives any suggestion to fix this problem.

Thanks,

The rest is the programming code:

import vex
import sys

#region config
brain = vex.Brain()
motor_1 = vex.Motor(vex.Ports.PORT1, vex.GearSetting.RATIO18_1, False)
motor_2 = vex.Motor(vex.Ports.PORT2, vex.GearSetting.RATIO18_1, False)
controller1 = vex.Controller(vex.ControllerType.PRIMARY)
#endregion config

competition = vex.Competition()

def driver():

Place drive control code here, inside the loop

while True:
# This is the main loop for the driver control.
# Each time through the loop you should update motor
# movements based on input from the controller.
if controller1.buttonDown.pressing():
motor_1.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.PCT)
motor_2.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.PCT)
elif controller1.buttonLeft.pressing():
motor_1.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.PCT)
motor_2.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.PCT)
elif controller1.buttonRight.pressing():
motor_1.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.PCT)
motor_2.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.PCT)
else:
motor_1.stop(vex.BrakeType.HOLD)
motor_2.stop(vex.BrakeType.HOLD)
competition.drivercontrol(driver)

def auto():

Place autonomous code here

pass
competition.autonomous(auto)

main thread

All activities that occur before competition start

Example: setting initial positions

pass

Can you set the project to public through the Options gear at the top right and copy the link to the project here?

2 Likes

https://www.robotmesh.com/studio/5db11354c27a3e5136f76bfc
This is the testing code. I use coding on my Mac Chrome.
Thank you for helping!

Thank you. Your code downloaded fine for me on one of my robots, so I’m suspecting something went wrong with the download of some piece of code.

First, make sure that you are running VEXos 1.0.8 on your Brain if you aren’t already. This might not be the problem, but it helps while ruling things out. Be sure to connect the USB cable to the Brain directly for this, as we can’t do firmware download over wireless. If this doesn’t fix anything, move on to the next step.

Next, try opening the Options gear and checking “Force Full Download”, then trying to download and run your code again. (You might want to do this step wired directly to the Brain, as the full download of the Python VM is somewhat large.)

Let me know the results of those two steps. If those don’t work, we’ll need to drill down into more specifics of what’s causing it.

1 Like

Hi, @John_TYler
I try Force Full Download today and it works. However, when I try to use my axis to control the robot forward and backward movement, the robot moves really slow. Can you provide some advice for me?

Thank you!

For sure. I have to deliver some bad news, though, which you might be expecting: there are errors in your code. Here’s a few things to look at:

First, you will want to address your if…else if…else block and how you are using the joystick values. Only one condition of a block like that can be run at a time, and you have sections where only one of your two motors get an instruction. The other motor will keep doing whatever it was told to do last.

Second, you should reevaluate some of the conditions that you are checking. The first one sticks out: if axis 3 is zero, spin motor 1 with a speed equal to axis 3 (which can only be zero, since the condition made sure that it was zero). This means that if axis 3 is zero, the only thing that the whole block does is let motor 2 continue whatever it was doing and stop motor 1. The second axis condition also needs a rethink for a slightly different, but similar, reason. I’ll give you a chance to see if you can see it.

Third, the set velocity blocks in conditions 1 and 2 don’t do anything. You don’t have any blocks that use the default velocity, and you specify a velocity with the spin blocks that come immediately after each. You can safely remove them.

That should be enough to get you started. Let me know if you get stuck again :slight_smile:

1 Like

Also, just for next time that you post code on the forum, use markdown syntax:

```cpp
code here
```

It makes things look nicer :wink:

(This was the generated Python from a Blockly project. Direct links to projects are nice, anyway, because people trying to help don’t have to do any copy-paste to see how it runs nor any detective work to find the exact error messages being created. It’s already on the web, might as well leverage it!)

2 Likes

@John_TYler I figure out the problem, the robot works properly.
Thank you for help.

1 Like

Just in case you don’t know, Robotmesh also offers excellent technical support via phone.

1 Like