acmerobotics / road-runner-quickstart

FTC quickstart for https://github.com/acmerobotics/road-runner
BSD 3-Clause Clear License
187 stars 1k forks source link

Autonomy model or smth... #307

Closed TheMujdii3 closed 10 months ago

TheMujdii3 commented 10 months ago

Hello there!Finally our code works well and we are in the phase where we cant make a model for our autonomies.Can someone help us with a model or some basic autonomy?Pls

rbrott commented 10 months ago

I'm not in the best position to help there. Consider talking to the folks in the FTC DIscord server. Once you have a specific goal in mind, I can help you use the RR API to design and coordinate various motions.

TheMujdii3 commented 10 months ago

yeah i kinda have problems with linetoy but ...

rbrott commented 10 months ago

I can probably help if you post the code

TheMujdii3 commented 10 months ago

yeah here package org.firstinspires.ftc.teamcode.OurCode;

import com.acmerobotics.roadrunner.Action; import com.acmerobotics.roadrunner.Pose2d; import com.acmerobotics.roadrunner.Vector2d; import com.acmerobotics.roadrunner.ftc.Actions; import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;

import org.firstinspires.ftc.teamcode.MecanumDrive; import org.opencv.core.Mat;

@Autonomous public class Blue_Short extends LinearOpMode { Robothardware robot = new Robothardware();

@Override
public void runOpMode()  {
    robot.init(hardwareMap);

    MecanumDrive drive  = new MecanumDrive(hardwareMap,new Pose2d(-12,-58.26,Math.toRadians(0)));

    Action drive_to_drop = drive.actionBuilder(drive.pose)
            //.lineToY(-56)
            //.lineToXLinearHeading(-56, Math.toRadians(90))
            //.lineToYSplineHeading()
            .lineToY(3)

            .splineTo(new Vector2d(-12., -50), Math.toRadians(90))
            .endTrajectory()
            .build();
    waitForStart();
    Actions.runBlocking(drive_to_drop);
    drive.updatePoseEstimate();

}

}

this the first part of my auto

rbrott commented 10 months ago

Ah. The start pose has a heading of 0deg, and the action builder will assume that the starting tangent is 0deg as well. If you want to move sideways, you need to change the tangent to 90deg before lineToY(). See https://rr.brott.dev/playground/?cbc25a58b9280d8b.

TheMujdii3 commented 10 months ago

Ohhhh thank u soooo much