Search
 
SCRIPT & CODE EXAMPLE
 

CPP

frc limelight tracking

float KpAim = -0.1f;
float KpDistance = -0.1f;
float min_aim_command = 0.05f;

std::shared_ptr<NetworkTable> table = NetworkTable::GetTable("limelight");
float tx = table->GetNumber("tx");
float ty = table->GetNumber("ty");

if (joystick->GetRawButton(9))
{
        float heading_error = -tx;
        float distance_error = -ty;
        float steering_adjust = 0.0f;

        if (tx > 1.0)
        {
                steering_adjust = KpAim*heading_error - min_aim_command;
        }
        else if (tx < -1.0)
        {
                steering_adjust = KpAim*heading_error + min_aim_command;
        }

        float distance_adjust = KpDistance * distance_error;

        left_command += steering_adjust + distance_adjust;
        right_command -= steering_adjust + distance_adjust;
}
Comment

frc limelight tracking

float KpAim = -0.1f;
float KpDistance = -0.1f;
float min_aim_command = 0.05f;

std::shared_ptr<NetworkTable> table = NetworkTable::GetTable("limelight");
float tx = table->GetNumber("tx");
float ty = table->GetNumber("ty");

if (joystick->GetRawButton(9))
{
        float heading_error = -tx;
        float distance_error = -ty;
        float steering_adjust = 0.0f;

        if (tx > 1.0)
        {
                steering_adjust = KpAim*heading_error - min_aim_command;
        }
        else if (tx < -1.0)
        {
                steering_adjust = KpAim*heading_error + min_aim_command;
        }

        float distance_adjust = KpDistance * distance_error;

        left_command += steering_adjust + distance_adjust;
        right_command -= steering_adjust + distance_adjust;
}
Comment

frc limelight tracking

float KpAim = -0.1f;
float KpDistance = -0.1f;
float min_aim_command = 0.05f;

std::shared_ptr<NetworkTable> table = NetworkTable::GetTable("limelight");
float tx = table->GetNumber("tx");
float ty = table->GetNumber("ty");

if (joystick->GetRawButton(9))
{
        float heading_error = -tx;
        float distance_error = -ty;
        float steering_adjust = 0.0f;

        if (tx > 1.0)
        {
                steering_adjust = KpAim*heading_error - min_aim_command;
        }
        else if (tx < -1.0)
        {
                steering_adjust = KpAim*heading_error + min_aim_command;
        }

        float distance_adjust = KpDistance * distance_error;

        left_command += steering_adjust + distance_adjust;
        right_command -= steering_adjust + distance_adjust;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to make a goto area in c++ 
Cpp :: The elements are store at contiguous memory locations in C++ 
Cpp :: std::string(size_t , char ) constructor: 
Cpp :: 496. Next Greater Element I.cpp 
Cpp :: 1162261467 
Cpp :: (/~/+|/+$/g, ') 
Cpp :: inversed priority queue 
Cpp :: hello command not printing in c++ 
Cpp :: FINAL CODES_MY_OS_LAB 
Cpp :: powers of 2 in cpp 
Cpp :: c++ cout int 
Cpp :: c++ multi-dimensional arrays 
Cpp :: how to make a segment tree in c++ 
Cpp :: Set Specific Time in youtube Video url 
Cpp :: how to initialize priority queue c++ 
Cpp :: C++ Counting 
Cpp :: hello world program in c ++ using standard namespace 
Cpp :: english to french typing online 
C :: c bold text 
C :: full installation of clang in ubuntu 
C :: c get file size 
C :: same project on different monitor in intellij mac 
C :: lerp function c 
C :: arduino client disconnect 
C :: C how to find substring in string 
C :: va_list in c 
C :: get last char string c 
C :: pthread c 
C :: slug urls django 
C :: arduino wifi client 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =