• Welcome to Redshift Project Depot.

LabVIEW progress report

Started by Louis L, January 14, 2018, 11:57:29 PM

Previous topic - Next topic

Louis L


I finally got a chance to take a closer look at what it'll take to get the LabVIEW code up and running with the Talon SRX / swerve drive.

Last year (2017) we never got the LabVIEW code to work the same way at the C++/Java code. I recall looking at the math and commands sent to the Talon controllers and they looked right yet things just didn't work. So getting things to work for 2018 is a second chance.

Took a closer look at the CTRE changes and they are a good bit more than I expected. Why do they keep changing this interface? Annoying!

I started the 2018 project, just working on the drivetrain. I re-coded the math portion of the swerve calculations using the original docs. Tomorrow I'll compare this with the Brayden's Java implementation (which is my reference because it does not contain the later cleansed work). Next will be to look into what it takes to mate the code with the CTRE API.

One bit of good news is that I did find a bug in the 2017 code - the IMU was never initialized correctly. But this was not cause of the problems because the code was set to ignore the gyro on the IMU.

All code has been checked in, no build errors.

Louis L


I exchanged some email with CTRE support to find out some more details about the new API. The VI library for CAN functions is very different from last year's version. Bummer.

Harshith and Neha were here tonight. They draw pictures of the first part of the algorithm. We then compared them with wht I had done previously. We then coded the ShouldReverse function as its own VI and added code to SwerveControl. The goal is to mimic Brayden's Java code, which is known to work, by the start of the weekend.

Louis L


Worked with Harshith to finish Swerve Control VI. The full path from Brayden's Java code is now in Labview. The file can still be made better by shrinking the 4 paths into one and using it 4 times in teleop. We should also see if this is something needs to be done for Swerve Calc VI.

The installation on Dev7 did something weird to the project. After Harshith checked in his new code, I had to work on my laptop - do a Pull, revert his change, manually put his file into my workspace, commit, then sync. That applied his change using my workspace files and that was fine. I couldn't find a way to take his commit and clean it up. Let's not use Dev7!

Louis L


No progress yesterday (no one to code).
Finished work on Swerve Control.vi. Harshith's previous code had a couple of bugs; easily fixed. Since the code was really 4 parallel paths of the same thing, I reduced the file to just one path. The caller now passes in the name of the wheel (steering and drive) as well as the ws and wa values. In teleop.vi, this VI is called 4 times in parallel for each of the 4 corners. The output connections on Swerve Calc.vi were moved around to make the connections to Swerve Control.vi cleaner. This completes the emulation of Brayden's drive code.

Next on the to-do list is to modify it to reflect the current (new) CTRE API for the Talon SRX. Also the init sequence needs to be added.

Louis L


The analog inputs for the absolute encoders were added in Begin and Finish.vi
Swerve drive steering PIDs are inited in begin.vi
Reading gyro now goes through Gyro Get.vi

Initialization is more or less done.

Next is to implement "turn to" equivalent from Brayden's Java code.

Louis L


Satis was free today so I got some time to test the swerve drive implementation.

Bad news: It's not working yet. The steering motors are not moving in response to user input. The drive wheels usually don't reverse direction when they should.

Good news: Turns out we can reach the RoboRio web interface with IExplorer (but not Edge or Firefox). So long as it's reliable that's all that matters. Also live debug is working so that's good. I have some debug test cases to look over to see if there's anything obvious in the code that's causing the problem.

Other: Started looking at the LabVIEW dashboard project and how to select autonomous. And looked at adding a camera (should be a no-brainer).

Louis L


Late report. Debug continues on the swerve drive code. Looks like we identified the expected problems with the encoder values being either in counts or +/- 0.5 or +/- 1.0. Conversion should take care of this. Also some strange behavior where the original code is using the integer quotient part of the count in the setting of the wheel angle - but because the count never wraps, this value is bound in +/- 1 and that's a problem. Will set to 0; should work.

Louis L


Debug continues. I think single wheel works but the initial reset doesn't. Need confirmation. One issue we had was that the live debug was causing timing problems with commands to the controllers and that led to weird behaviors where the wheel would sometimes jump around a lot.

Neha P


Attendance Update:

I will be coming in Thursday and Saturday to help continue to debug the code. The team and I are still trying to work out a more predictable schedule, but now that midterms week is over, I expect we will be showing up a lot more.

Next time the whole team meets, I'm hoping to spread out tasks (arm, autonomous, etc) so that we can be working on more than just Swerve.

Louis L


Not much progress today. Swerve drive debug continues but had limited time on the chassis due to the UI meeting. Ohad says the observed behavior is reminiscent of the inversion problem he saw earlier so we're not that far away. So the good news is that the swerve drives are most likely going to work with LabVIEW so we forge ahead with other code. Had this not worked, it would have been pointless to continue.

Louis L

It's getting closer. Ohad explained why I shouldn't undo some of Brayden's code regarding the encoder values. Oh well, time to fix it. But we're close. Really!

Neha is starting on writing the code flow for the main user functions - This includes conditions to check for, motors to spin up, sensors, etc.

Harshith is working on getting all of the hardware defined in the hardware map added to Begin and Finish. This'll get him going with using Labview and seeing the various names of modules in the library.

Louis L


The swerve drive works!
A bunch of prep work was done to prepare for everything else that need to be coded.

Louis L


Got Field Centric driving to work.
- Need to test the robot with the original L & W to see if some of the strangeness in the wheels are caused by values that are not really what's on the test robot.

Started setup in Teleop for user button decoding.
First command done - needs integration and testing.

Command flow for all 16 commands needs review and refinement. Doc is shared on google.

Louis L


Minimal progress tonight.
Took Harshith's Gyro Toggle code, merged it with rest of code base. Optimized it too.
Neha is worked on Fix Stuck Cube.
Harshith started on Intake Flush.

Louis L


Flush intake is done
fix stuck cube is done

Created templates for
release cube
climb up/down
fine tune up/down