Reserved for discussion of mechanical maintenance of V5 smart motors
DO NOT use industrial lubricants like WD-40 or white lithium grease on internal plastic gears inside V5 motors or cartridges.
You may use light synthetic oil or synthetic grease like SW-92SA that is used for fine/plastic mechanical internals of cameras, printers, keyboards, dvd players, etc…
Broken Motor Inserts
V5 motor Cap and Threaded Insert replacement parts are sold separately
May need to be moved into V5 Motor electric/programming entry:
vexos 1.0.9 uses a different algorithm than versions 1.0.8 and earlier.
8 or less motors are still capped at 2.5A.
9 or more are capped as follow, remember this is current at the motor not current from the battery,
9 2.39A
10 2.29A
11 2.20A
12 2.12A
13 2.04A
14 1.98A
15 1.91A
16 1.85A
17 1.80A
18 1.74A
19 1.69A
20 1.65A
However, those values are only valid if user code has not set current limit lower on one or more motors. If that has happened we take the user specified lower motor curren…
1 Like
Reserved for V5 components overview
3-wire:
The issue is that the build system will not guarantee the order in which instances are created across different source files.
The instance of Brain is defined I’m assuming somewhere else such as robot-config.cpp. That means it may not have been created, and therefore the Brain.ThreeWirePort also not created, when you try to access it in your main.cpp source file. The solution is to either move
bumper LiftBumper = bumper(Brain.ThreeWirePort.A);
into the same file (and placed after) as the Br…
Specific 3-wire port numbers for dual wire sensors:
Pretty sure all programming solutions either enforce this or have documentation explaining it. For example, PROS has
Encoders must be plugged into the ADI such that the top wire
is in an odd numbered port (1, 3, 5, 7 or ‘A’, ‘C’, ‘E’, or ‘G’), and then
the bottom wire must be in the next highest port number.
Possible problem due to order of initialization of 3-wire port accessor instances:
Memory Permission Error
Temporary workaround for 8 legacy 3-wire port limit:
Connect multiple sensors to a single port to overcome the limit of 8 legacy ports
Legacy, non competition legal components:
Using Flashlight in VCS
1 Like
Reserved for Bumper and Limit Switch wiki entry
Reserved for VEX Potentiometer wiki entry
Reserved for Quad Encoder wiki entry
Reserved for IMU / Gyroscope wiki entry
Description
The Inertial Sensor is a combination of a 3-axis (X, Y, and Z) accelerometer and a 3-axis gyroscope. The accelerometer will detect a change in motion (acceleration) in any direction and...
V5 Inertial Sensor
This procedure calibrates the accelerometers in the Inertial sensor and saves the result in non volatile memory.
This procedure needs vexos 1.0.10 or later.
Only perform this calibration if your VEX inertial sensor is showing angles for roll and/or pitch that are larger than perhaps 1 or 2 degrees when the inertial sensor is on a flat surface that is known to be level in both axis.
Some inertial sensors can show significant error for roll and pitch when placed on a level surface. To check a…
When you run a program, the inertial sensor starts a calibration sequence, the first second of that sequence does not look at gyro values, it just waits for everything to stabilize, so any movement from touching the V5 should have stopped. It won’t hurt if you restart the calibration at the beginning of your program, I’m just saying that it’s not strictly necessary. You can also choose to manually recalibrate the inertial sensor at any time by going to the dashboard and selecting calibrate, yo…
3 Likes
Reserved for Light Sensor wiki entry
Reserved for Ultrasonic / sonar / rangefinder sensor wiki entry
Correct.
Yes, the ROBOTC executive and interrupts handle the ultrasonic sensors.
You can stop the ultrasonic by setting the sensor type to “sensorNone”, I don’t see why you would want to though, the overhead is minimal. Some demo code to show how to do that.
#pragma config(Sensor, dgtl1, sonar1, sensorSONAR_cm)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while(1)
{
// Turn off sonar
if( vexRT Bt…
No official way and the unofficial way is unreliable.
The Ultrasonic sensor is polled approximately 20 times per second but varies depending on the distance.
The ping is initiated, the receiver will wait up to about 36mS for a reply, there is a delay of 50mS before the next ping.
Here is the sonar detecting an object about 130cm away. The blue trace is the output ping, the yellow trace goes low when the reply is received.
[sonar_130.jpg]
Here is the sonar failing to detect a reply.
[son…
1 Like
Reserved for V5 Vision sensor wiki entry
have a look at these knowledge base articles.
https://help.vex.com/category/205-vision-sensor
There are two different ways to configure the sensor depending on whether you want to use the robot config panel or just create vision header files.
https://api.vexcode.cloud/v5/html/classvex_1_1vision.html
Vision Sensor
USD: $79.99
This is a demonstration of how to write code using the V5 Vision Sensor to find a vision target object, and then orient your robot to “face” directly towards the target. You will need to configure the vision sensor before trying the program. We include a link to how to configure the Vision Sensor here .
Sample Projects
Blockly Python C++
[image]
There still seems to be some issues setting up the vision sensor. Although we do know that VCS 1.0/vision sensor utility has a few bugs in this area, it is still pretty simple, I’m not sure why the theories about needing to freeze the image are running around. Anyway, here’s a quick demo showing how easy it is.
The configuration that is hidden inside robot-config.h looks like this and is what is used in your program to setup the vision sensor when it runs.
vex::vision::signature SIG_1 (1, -…
I had a play around today with the vision sensor on one of my old demo robots. The goal was just to test some simple targeting code that could be used as a basis for a more complex program. The robot setup looks like this.
[P1050576]
I obviously have a large target, but the concept would be the same no matter what size although the code would need to filter out more noise (meaning removing small intermittent objects) with something less well defined. I have the vision sensor mounted sideway…
I’ve been asked a few times about the vision sensor field of view.
I wrote in this thread that is was 67 deg, that was based on quick measurements with a target pretty close to the sensor, that number is close but not correct.
@Windows10010 posted earlier today here that they thought it was 30 deg, that seemed way too narrow from what I remembered.
I used to do this type of measurement often as I worked in the film industry for a camera manufacturer. It’s pretty easy to do, harder with this …
Get more with VEXcode We recommend you transition to our new software. VEXcode has both block-based and text-based options, that work on Chromebooks, iPads, And
Some debugging tricks:
If you look at the V5 dashboard when you are running your code, do you see the detected objects ?
When your code is not running, you can test the vision sensor with our preset values for red, green, blue and yellow, but these settings are not related to anything in your program, they are just for testing if it is working.
Meaning of Vision Sensor parameters?
Vision Sensor config - objectCount inconsistent
V5 Vision Sensor "The Camera detected must be unlocked"
Vision Sensor Wifi
Vision Sensor Having Issues Seeing Objects
V5 Vision Sensor Color Code Coordinate Tracking
Vision Sensor Math:
EDIT: DODGY AND/OR INCORRECT MATH
CASE WITH GROUND OBJECT
I am not that confident in my math, but here is what I came up with.
SETUP
Your sensor is mounted on a tower. Your sensor is always a certain distance from the ground, if your robot stays level.
[image]
The sensor can see objects, and it gives them X and Y coordinates. (x is between 0 and 640, y is between 0 and 400.) I am not sure if the coordinates will work exactly as shown, but it wil…
Object Tracking:
We’ve been experimenting with the V5 vision sensor to better understand how it works and what its limitations are. Theo, our programmer, has so far been able to make it track and follow a ball using just a P loop for now. We used an old NBN ball because our game objects hadn’t arrived yet.
4 Likes
Reserved for V5 Optical Sensor
Vex Knowlege base article
1 Like
Reserved for V5 Distance Sensor
Vex Knowlege base article
1 Like
Reserved for V5 3-Wire Expander
(I’m not so sure this needs it own entry but I will put it for now - Floub)
https://kb.vex.com/hc/en-us/articles/360047144991-Using-the-3-Wire-Expander-Sensors-for-VEX-V5
1 Like
Reserved for V5 Rotation Sensor
We have a winner. It’s an absolute magnetic encoder, can spin infinitely in either direction, and can accept a pass through HS shaft.
Neither. It uses a different technology. It remembers position only within the 0-360 deg range, but can also work like an encoder and provide a continuous position and velocity.
Ninjaed by Art…
1 Like
Reserved for V5 controller information, tips, and tricks
https://help.vex.com/article/16-how-to-update-your-v5-wireless-controller-firmware
https://help.vex.com/article/11-pairing-wireless-controller-to-the-brain
https://help.vex.com/article/36-how-to-calibrate-the-v5-controller
https://help.vex.com/article/15-how-to-reset-your-controller
Scuff controller add on for V5:
V5 Scuff Controller Add-on | Online Challenges
Since so many people have been asking in this thread recently, here’s a .zip containing all the parts in STL format:
v5_scuff_controller.zip (2.7 MB)
Controller mod for USB-C:
I’m having trouble fixing some problems that came up with the original Inventor files after I went through them again to make the final report for the Online Challenge so I’m not able to release those files yet, but I do have the .obj files from when I 3D Printed the prototype.
It might not be the best experience yet as it’s only V1 (for example, the bottom paddles are a bit awkward, and the clamshells need a ton of support), but if you really want them you can download it here:
https://drive…
Issues: (check if this is still the behavior)
We can only send a new line of text to the controller every 50mS due to the relatively low bandwidth channel we have between brain and controller. If a call is made to controller.screen.print before 50mS has elapsed from the previous call, we call task::sleep on that thread until the 50mS requirement has been met.
With PROS, you have to delay between each command by 50ms. If you don’t, the commands you send will not be forwarded to the controller, which only updates every 50ms.
I believe VEXCode automatically inserts those delays in the controller commands for you.
Controls (move to programming section later):
Best joystick controls for drive train?
Tank or Arcade???
Controller troubleshooting dashboard:
V5 controller don't respond to the programming - #11 by jpearman
4 Likes
Reserved for V5 custom cables how-to
As someone who has been crimping Category cable since well before V5 was released, only recently did I finally have the chance to try crimping V5 cables.
What I can say beyond a shadow of a doubt is that VEX’s crimping tool, with a plastic die, is utter garbage. I had several failed crimps, causing the Brain to simply not recognize connected motors. When I did a sanity check with a crimping tool I used for actual Category cabling (with a metal die, just like every crimping tool worth anything), every single crimp worked (and yes, I used the exact same technique).
So, for all I know, the incidence of issues with custom-crimped cables but not factory-crimped cables could somehow be related to the crimping tool. Your mileage may vary, but I can confidently recommend even this $10 crimping tool over VEX’s. You can even get a whole crimping kit, complete with cable tester , for less than the price of VEX’s crimping tool (I can confirm the crimping tool in this exact kit worked perfectly on V5 cable).
TL;DR Try using a real crimping tool in the future. Testing your cables with a cable tester before use is a good idea too.
More V5 smart cable details
4P4C refers to the connector, also known as RJ9,10, 22.
The cables themselves are custom specified for the load of V5 devices. A standard 4 wire flat cable with 26 awg with may work, but it won’t be ideal. And it’s ok for testing purposes but know you’re accepting responsibility for all the risks it entails.
It’s not legal for competition.
Aside from the rules stating that V5 smart cables must be used for competition. Not all cables are created equal, here is a comparison, I don’t have specs for either the VEX cable or the random silver 4 conductor phone cable I had, but there’s a significant difference.
4 Likes
Reserved for V5 in-depth system architecture overview
https://www.vexrobotics.com/v5-architecture.html
VEXCode get Run Time function?
raw message rate for the inertial sensor is 50Hz. Three wire port (ADI) is 100Hz. Motor is 200Hz, but data is still only available to user code at 100Hz as explained by @hotel .
I’m very skeptical about the double integration being able to reproduce accurate results, but will be happy if someone can prove me wrong.
Defining three wire devices in text
Move to separate RS485 entry later:
This is mainly aimed for @jpearman .
Is there any way to provide power to a DC device through a smart port by taking a smart cable and splicing up one end? I’m trying to find a way to power LED lights from smart ports so that I don’t have to waste a legacy port.
You can already use VEXcode (and VCS) to interface to custom electronics using a smart port as a generic serial RS485 port. There’s only a C API at the moment, and little documentation, we will probably add a C++ API before next season.
Contact me for more details and I can provide some sample code.
Move to programming / multitasking section later:
The VCS/VEXcode scheduler is very similar to the ROBOTC scheduler. There are some differences due to the fact that ROBOTC was running as a virtual machine and had more control over when exactly the task switching could occur, however, the concepts are very similar.
startTask( myTask ) becomes vex::task taskId( myTask )
wait1Msec(10) becomes task::sleep(10)
AbortTimeSlice() becomes task::yield()
and so on.
(and I fixed the broken links in the original topic)
Here is some example code. It’s from VEXcode but should work in VCS as well.
It uses additional tasks for drive and controlling a motor with one button.
#include "vex.h"
using namespace vex;
// A global instance of vex::brain used for printing to the V5 brain screen
vex::brain Brain;
// A global instance of vex::competition
vex::competition Competition;
// define your global instances of motors and other devices here
vex::motor leftMotor( vex::PORT1 );
vex::motor rightMotor( vex::P…
Move to programming communication section later:
VEXcode V5 Text Preview
Wireless Uploading and Terminal Usage to V5 Brain (multiple posts about V5 communication)
Possible problem due to order of initialization of 3-wire port Brain.ThreeWirePort instances:
Memory Permission Error
3 Likes
Reserved for V5 in-depth system troubleshooting topic 1
Motor commands and dynamic power limiting information:
vexos 1.0.9 uses a different algorithm than versions 1.0.8 and earlier.
8 or less motors are still capped at 2.5A.
9 or more are capped as follow, remember this is current at the motor not current from the battery,
9 2.39A
10 2.29A
11 2.20A
12 2.12A
13 2.04A
14 1.98A
15 1.91A
16 1.85A
17 1.80A
18 1.74A
19 1.69A
20 1.65A
However, those values are only valid if user code has not set current limit lower on one or more motors. If that has happened we take the user specified lower motor curren…
so most of the time teams are not sending a voltage to the motor but rather a requested velocity. Even when the motor is told to stop, it may be using a significant amount of power depending on the brake mode of the motor.
The current limiting happens inside each motor, even when we limit continuous current to 2.5A, the transient current can be much more than that and the motor needs to respond quickly to these changes. Individual motors don’t have knowledge of what all the other motors are …
It’s a feature (bug really) of PROS. vexos keeps the configuration for flags like reverse if the motor is not present when user code starts or is unplugged, however, PROS doesn’t send it though on startup if it thinks there is no motor, VEXcode however does. The things we keep backup values for are
brake mode
encoderUnits
gearset
reversed
currentLimit
voltageLimit
One reason for keeping these values is safety, I didn’t want a motor running at full power when user code had aske…
That’s correct, the reverse flag is handled by vexos and not sent to the motor, it’s much easier to handle things like updating the current motor position when user code changes the reverse flag while the motor is running (why you would want to do that I don’t know, but some of these design decisions were taken more than 4 years ago and based on robotc functionality).
yea, PROS always validates the the correct type of device is on a given port before calling into vexos
4 Likes
Reserved for V5 in-depth system troubleshooting topic 2
Important information about event callbacks implementation and its limitations:
Does old callback get erased when I set new callback function?
No, callbacks for an event should only be registered once, registering an additional callback will cause both to fire, registering a null pointer will not free resources.
It does consume additional resource, event handlers should only be registered once, if you register either the same or an additional callback the event will call both handlers.
On V5 each event handler is a thread blocked on a semaphore, when the event fires, vexos released the semaphore allowing the thread to run, the thread calls the user registered callback.
There is currently no way to unregister an individual event handler.
On IQ, which uses the same core functionality in VEXcode, we don’t have enough memory to dedicate a thread to each event so we have to use a thread pool instead, this limits the number of events that can simultaneously fire and be serviced.
yea, I set the limit at 100 events. Some are registered when you create, for example, an instance of a competition object. If you have some tasks, that limit is reduced, limit for tasks is 128, but as an event also runs as a task it uses resources for both.
Callbacks
4 Likes