I am trying to use RobotMesh with the old Cortex Clawbots. My goal is to (teach my students to) create a code that allows the robot to move autonomously using sensors using Blockly. I would like to make a maze and use the bumper sensor to get through the maze, like the first maze challenge on vex VR.
There’s a lot of very basic stuff I can’t figure out. Here are some of my questions:
- How do you make the robot turn? Do you need to create a function for this? How do you use the shaft encoders to control how far it turns? I would like to make (approx) 90 degree turns
How do you wire the shaft encoders? There are 2 3-prong wires connected to each encoder, and I don’t know what the two wires do/go and therefore (I figured this part out) have no idea how to put this in in robotmesh correctly
- Once you have a code written, how to you execute the code/tell the robot to start it?
I guess these are my main questions right now. I definitely have a lot more questions but I am a bit overwhelmed by all I don’t know that I I’m not even sure what to ask.
The simplest and crudest way to do this is by starting the motors, waiting some time, and turning them off again. Something like this:
Then change the number in the
sys.sleep call with some trial and error until you get somewhere near a 90 degree turn. You can copy and paste that code every time you want to turn (boo) or put it in a function, like you suggested:
(As usual, the indentation is required in Python)
It is possible to include the optical shaft encoders, but it would require moving some stuff around on the Clawbot chassis.
Note that time-based or encoder turns will have a certain amount of slop. It may be difficult to navigate a lengthy maze with them. If you have the discontinued Yaw Rate Gyroscope you could use it here.
Once the code is written, click the “Run” button to run it. You must have Robot Mesh Connect installed. If it is not installed, you will need admin permissions on the computer you’re using to install it. Click the “Install RMC Plugin…” link in the top right for instructions.
Thank you so much!
Is there a way to integrate this code into the blockly approach? I’m trying to make it as simple as I can for my students with very little coding experience. In my (very limited) experience, it looks like you can either do written code or blockly but not both nvm I figured out how to make a function on blockly