OCCRA
Go to Post I began to see myself as an independent person who was not only being inspired, but able to inspire others and strengthen the FIRST program as a whole. - Jaine Perotti [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-25-2018, 11:35 PM
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 114
grosh is an unknown quantity at this point
CTRE Motion Magic Example help

I'm not sure what the behavior of the CTRE Motion Magic Phoenix- Labview examples should be. We tuned all of the variables described in the software manual and can get the motors to reliably stop at the desired position when we press and hold button 0 to engage motion magic and pull the joystick to full power until it reaches the desired position.

However, if we reset the encoder to zero and try again the motor drives backward a little and stops before we apply power.
Reply With Quote
  #2   Spotlight this post!  
Unread 05-26-2018, 10:32 AM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

The joystick does not command the system in power when motion magic is engaged. The joystick is an analog source of positions. Is the joystick value at rest maybe slightly negative. So when button 0 is pressed the command position is not zero but something else.

We use Motion magic to position our lift. Using Java
__________________
It makes sense in my mind.



Reply With Quote
  #3   Spotlight this post!  
Unread 05-26-2018, 10:45 AM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

Ok so in the Java example
Code:
/* Motion Magic - 4096 ticks/rev * 10 Rotations in either direction */
double targetPos = leftYstick * 4096 * 10.0;
_talon.set(ControlMode.MotionMagic, targetPos);
That is the system will travel -10 to 10 encoder rotations. So even if the joystick is floating at .05 you would get a half rotation.

Code:
-2046 ticks = -.05 * 4096 ticks/rev * 10.0 revs

(-2046 ticks) / (4096 ticks/rev) = -.5 revs
__________________
It makes sense in my mind.




Last edited by cpapplefamily : 05-26-2018 at 10:51 AM.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-26-2018, 12:59 PM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

I posted Here an excel spreadsheet the formulas used in the java section of the SRX guide.
__________________
It makes sense in my mind.



Reply With Quote
  #5   Spotlight this post!  
Unread 05-26-2018, 08:12 PM
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 114
grosh is an unknown quantity at this point
Re: CTRE Motion Magic Example help

That helps. I think I get the logic now. The spreadsheet was also really helpful. I got the robot to react perfectly using the CTRE example. However, I'm having trouble implementing it in our team's code. It acts like a PID closed loop without the benefit of Motion Magics ramp up/ramp down. I've attached a picture of our code. Any thoughts?

Also, in Section 12.6.3 where did the value 1023 come from in calculating f-gain?

Click image for larger version

Name:	no-Magic auto code.PNG
Views:	22
Size:	21.5 KB
ID:	23436
Reply With Quote
  #6   Spotlight this post!  
Unread 05-26-2018, 10:16 PM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

As we explore your troubles it may help to know what your trying to do.
__________________
It makes sense in my mind.



Reply With Quote
  #7   Spotlight this post!  
Unread 05-26-2018, 10:28 PM
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 114
grosh is an unknown quantity at this point
Re: CTRE Motion Magic Example help

We have always run our auto routines using encoder values alone. For example, drive forward 600000 encoder ticks and stop. As you know this is not very reliable. We would like to use Motion Magic to be more accurate and eliminate wheel spin at the beginning of auto.

I have propped the wheels off the ground of our 2018 practice robot. I am only driving the left side drive wheels. I am using it as a test base to learn Motion Magic.

In the attached program I want to drive to 600000 encoder counts with a smooth ramp up to eliminate wheel slip and a smoother ramp down to help achieve the target of 600000 encoder ticks.

At this time the robot completes the goal using the CTRE example, but it doesn't accelerate slowly as it does when we use the CTRE example.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-26-2018, 11:10 PM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

I don't believe Motion Magic is a good application for drivetrains. I suppose it would and will work but Motion Profiling seem to be what teams use in this situation.

Quote:
Also, in Section 12.6.3 where did the value 1023 come from in calculating f-gain?
Looks like either I have the chapter references wrong or they where shifted from an older manual when I created this. Looks like its 12.6.4 now. The 1023 are the native units the SRX would get if set to 100% output. I'm can follow Labview somewhat and promises I will likely now at least install it on a PC soon to look at the samples. Could you try to set a crazy hi Max Acceleration to make sure things are working?

Since I don't have Labview can you post a screen shot of the sample VI?
__________________
It makes sense in my mind.



Reply With Quote
  #9   Spotlight this post!  
Unread 05-26-2018, 11:24 PM
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 114
grosh is an unknown quantity at this point
Re: CTRE Motion Magic Example help

I've attached pictures of the CTRE example.

I looked at motion profiling... it's a little beyond me at this time. But, i'm up to an off-season challenge.

Click image for larger version

Name:	mm block 1.PNG
Views:	20
Size:	38.9 KB
ID:	23437
Click image for larger version

Name:	mm block 2.PNG
Views:	16
Size:	33.9 KB
ID:	23438
Click image for larger version

Name:	mm front panel.PNG
Views:	13
Size:	48.6 KB
ID:	23439
Reply With Quote
  #10   Spotlight this post!  
Unread 05-26-2018, 11:40 PM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 760
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: CTRE Motion Magic Example help

? So the labview sample doesn't use the joystick to command a variable distance to goto but instead gets the encoder ticks from the number box on the UI? Or is the UI displaying the( joystick value encoder counts per rev 10)
After that....
The question now is what is different when you run the sample that works and your modified code. Are you selecting different encoder type ie ctremagencoder vs quad....
__________________
It makes sense in my mind.



Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:10 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi