I am hoping to use the vision sensors as a remote video link for an in-class competition, but am having two problems:
- The frame rate consistently drops to below 2 FPS or stops all together within a few seconds of connecting. Refreshing the browser sometimes fixes this for a second or two.
- The wifi regularly goes offline within minutes of turning on the V5 brain, and does not go back online without rebooting it.
Setup:
- Vision wifi is turned on in the V5 brain settings.
- I am connecting using Chrome, Firefox, and Edge to 192.168.1.1
- Vision sensor is plugged in to port 16
- Vision sensor is configured to port 16 in VexCode Text
- Vision sensor is not referenced anywhere else in the code.
*Range from robot to PC: < 15 feet
I don’t think the code is the problem, but I have included it anyway just in case:
Program Code
/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: VEX */
/* Created: Wed Sep 25 2019 */
/* Description: Holonomic Drive for Clawbot (Individual Motors) */
/* */
/* Name: Mr. Cotter */
/* Date: 12/05/2019 */
/* Class: Engineering 2 & 3 */
/* */
/*----------------------------------------------------------------------------*/
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// FrontLeftMotor motor 1
// FrontRightMotor motor 10
// ClawMotor motor 3
// ArmMotor motor 8
// BackLeftMotor motor 9
// BackRightMotor motor 2
// Controller1 controller
// Vision16 vision 16
// ---- END VEXCODE CONFIGURED DEVICES ----
#include "vex.h"
using namespace vex;
int motorLimit(int percentage) {
int maxSpeed = 80; //set maximum speed to 80%
if(percentage > maxSpeed) {
percentage = maxSpeed;
}
return percentage;
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while(true){
//Read input values from joystick
int yMovement = Controller1.Axis3.position(percent);
int xMovement = Controller1.Axis4.position(percent);
int turnMovement = Controller1.Axis1.position(percent);
// Deadband stops the motors when inputs are too close to zero.
int deadband = 5;
if(abs(yMovement) < deadband) {
yMovement = 0;
}
if(abs(xMovement) < deadband) {
xMovement = 0;
}
if(abs(turnMovement) < deadband) {
turnMovement = 0;
}
turnMovement=turnMovement*0.8;
//Set velocity for all drive motors
FrontLeftMotor.setVelocity(motorLimit(0-yMovement - xMovement + turnMovement), percent);
FrontRightMotor.setVelocity(motorLimit(0-yMovement + xMovement - turnMovement), percent);
BackLeftMotor.setVelocity(motorLimit(yMovement + xMovement + turnMovement), percent);
BackRightMotor.setVelocity(motorLimit(0-yMovement + xMovement + turnMovement), percent);
//Spin Motors
FrontLeftMotor.spin(forward);
FrontRightMotor.spin(forward);
BackLeftMotor.spin(forward);
BackRightMotor.spin(forward);
//Arm Control
if(Controller1.ButtonL1.pressing()) {
ArmMotor.setVelocity(40,percent);
ArmMotor.spin(forward);
}
else if (Controller1.ButtonL2.pressing()) {
ArmMotor.setVelocity(30,percent);
ArmMotor.spin(reverse);
}
else {
ArmMotor.setStopping(hold);
ArmMotor.stop();
}
//Claw Control
ClawMotor.setVelocity(60,percent);
ClawMotor.setStopping(hold);
if(Controller1.ButtonR1.pressing()) {
ClawMotor.spin(forward);
}
else if (Controller1.ButtonR2.pressing()) {
ClawMotor.spin(reverse);
}
else {
ClawMotor.stop();
}
// ........................................................................
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}