Go to Post Gracious Professionalism is a compass, not a set of calipers. It should be used to guide what you do rather than to measure it. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 27-11-2014, 22:24
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

The roboRIO is indeed faster, and it has multiple cores, but if you were able to analyze the existing code and identify why it is lagging, that would give you a big head start. Do you have ideas why it is lagging? CPU usage numbers, graphs of sensor readings for known transitions, control updates on the same time scale?

Greg McKaskle
  #17   Spotlight this post!  
Unread 27-11-2014, 22:32
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,367
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Assumptions to be made at this time - chances of the new can motor controller having a rich enough firmware to handle the positional control of the module steering is very low, even less for PWM sensor input. The robo rio will have to close the loop. The robo rio should be more than fast enough to handle the well written swerve code and any other robo processing. Vision is the exception.

We use labview and lag is not a problem. 1st year we did. The code did not embrace data flow. One source of lag is the reading of the sensors. Is it in a periodic task or the main teleop loop?
  #18   Spotlight this post!  
Unread 27-11-2014, 22:43
s1900ahon s1900ahon is offline
Registered User
AKA: Scott McMahon
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 156
s1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant futures1900ahon has a brilliant future
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by bharrison6 View Post
Or better yet use the Jag's CAN closed loop to hold a position with PWM (If it was supported).
Jaguar only supported a single input gear tooth sensor, quadrature encoder inputs, and an analog input (0-3V) as closed loop sensor inputs. It never supported a PWM input as a closed loop sensor input.

But you should be able to use an absolute analog encoder output on a Jaguar provided that it is within the input range.
  #19   Spotlight this post!  
Unread 27-11-2014, 23:38
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by Greg McKaskle View Post
Really? There is an IEEE conference on just that topic, though they prefer visual languages. I guess they aren't working on real CS problems like turning a wheel.
Quote:
Originally Posted by magnets View Post
Tell that to the kid who makes almost twice as much as I do (an engineer with 20+ years of experience) straight out of college who was only hired because he was an excellent labview programmer. Labview is way more than powerful enough for your swerve drive, and Id argue that it's debugging tools and more sophisticated built in control signal processing and analysis libraries would make it more practical and less work than c++.
I didn't say that visual languages were useless. I also didn't say that they weren't a serious area of study. I said that they weren't used to do real computer science. I guess should clarify. Would you use a visual language to do cutting-edge work in any of the following areas:

-Data structures
-Formal verification
-Information theory
-Artificial intelligence
-Computer graphics
-Cryptography
-Networking
-Distributed systems
-Databases

I think the answer is no. I'm not saying that it's impossible. I'm saying that it's not done, or at least it's very unusual.
  #20   Spotlight this post!  
Unread 28-11-2014, 09:40
bharrison6 bharrison6 is offline
Registered User
FRC #3843
 
Join Date: Jan 2014
Location: Murray Ky
Posts: 37
bharrison6 is on a distinguished road
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by Gdeaver View Post
Assumptions to be made at this time - chances of the new can motor controller having a rich enough firmware to handle the positional control of the module steering is very low, even less for PWM sensor input. The robo rio will have to close the loop. The robo rio should be more than fast enough to handle the well written swerve code and any other robo processing. Vision is the exception.

We use labview and lag is not a problem. 1st year we did. The code did not embrace data flow. One source of lag is the reading of the sensors. Is it in a periodic task or the main teleop loop?
We just read them in the main teleop.
  #21   Spotlight this post!  
Unread 28-11-2014, 10:56
bharrison6 bharrison6 is offline
Registered User
FRC #3843
 
Join Date: Jan 2014
Location: Murray Ky
Posts: 37
bharrison6 is on a distinguished road
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by Ether View Post
How are you planning to decode that PWM signal?


I'm sorry I missed this earlier. Yes we want to decode it and use it rather than use analog because it will be more precise. I think all I need to do is figure out how to read the duty cycle of the PWM input. I know its not easy but I think it is supposed to be possible. Regardless if we can figure out how to do it then we just put a low-pass filter on it and run it as analog.

Since you ask, do you know how to decode the signal and if not will using a pwm w/ low pass filter effect the quality of the analog signal vs just buying a regular analog absolute encoder?
  #22   Spotlight this post!  
Unread 28-11-2014, 11:07
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Quote:
I said that they weren't used to do real computer science...
From my experience, real computer science is often done with borrowed mathematical notation, proofs, and usually some library that is grafted to an existing language favored by the author or advisor. Graphical or visual aspects may be included when they relate to content entered by or presented to end users of the research. UML is a good example of formalized graphics. Sketch systems are another. Visual query specification for databases is a thing too. Perhaps the most important to this discussion are domain-specific languages such as those developed by MIT Media Lab, NI, and LEGO.

I simply saw no reason for the statement to be in this thread. The majority of programming in the real world is done by technical people who do not have a CS degree. All technical professionals should learn how to program and be given the correct tooling to make them successful. Just as math courses aren't only for math majors, FRC programming isn't only for future CS researchers.

Greg McKaskle
  #23   Spotlight this post!  
Unread 28-11-2014, 11:11
bharrison6 bharrison6 is offline
Registered User
FRC #3843
 
Join Date: Jan 2014
Location: Murray Ky
Posts: 37
bharrison6 is on a distinguished road
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by bharrison6 View Post
I'm sorry I missed this earlier. Yes we want to decode it and use it rather than use analog because it will be more precise. I think all I need to do is figure out how to read the duty cycle of the PWM input. I know its not easy but I think it is supposed to be possible. Regardless if we can figure out how to do it then we just put a low-pass filter on it and run it as analog.

Since you ask, do you know how to decode the signal and if not will using a pwm w/ low pass filter effect the quality of the analog signal vs just buying a regular analog absolute encoder?
I just looked at Lab View and found the PWM Get Value function under the WPI -> I/O -> PWM -> Get Value. I am guessing I can't just plug the pwm into the digital side car can call this function since the Digital Side Car to my knowledge only outputs PWM, it can not read the PWM?
  #24   Spotlight this post!  
Unread 28-11-2014, 11:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by bharrison6 View Post
Yes we want to decode it and use it rather than use analog because it will be more precise.
How did you determine that it will be more precise? e.g. Did you consider the tolerances in the encoder datasheet as well as the tolerances in the decoding methods?

Quote:
I think all I need to do is figure out how to read the duty cycle of the PWM input.
"all I need to do"... How do you plan to do that?

Quote:
Since you ask, do you know how to decode the [PWM] signal
I've heard the FPGA sampling frequency will be bumped up from ~153KHz (in 2014) to ~1MHz (in 2015). Maybe the FPGA will be programmed in 2015 to read duty cycle (detect and report consecutive rising-to-falling and falling-to-rising edge pairs). If so, you could decode the PWM quite accurately using that. Otherwise, you'd probably need to use high-priority interrupts to detect and time-stamp the edges. I don't know what the interrupt latency will be in the roboRIO with LinuxRT and WPILib and LabVIEW.

Quote:
just put a low-pass filter on it and run it as analog.
How much filtering would be required to reduce the analog noise to an acceptable level, and how much phase lag would that introduce?

Quote:
will using a pwm w/ low pass filter effect the quality of the analog signal vs just buying a regular analog absolute encoder?
My guess would be yes, but I haven't looked at it in depth.



Last edited by Ether : 28-11-2014 at 11:54.
  #25   Spotlight this post!  
Unread 28-11-2014, 11:37
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by bharrison6 View Post
I just looked at Lab View and found the PWM Get Value function under the WPI -> I/O -> PWM -> Get Value. I am guessing I can't just plug the pwm into the digital side car can call this function since the Digital Side Car to my knowledge only outputs PWM, it can not read the PWM?
There will be no DSC in 2015. That function will be integrated into the roboRIO.

See my previous post for thoughts on how a PWM signal might be decoded using digital inputs.




Last edited by Ether : 28-11-2014 at 11:52.
  #26   Spotlight this post!  
Unread 28-11-2014, 12:18
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Be sure to read the documentation or description for the Get PWM function. Names can be misleading.

Greg McKaskle
  #27   Spotlight this post!  
Unread 28-11-2014, 12:28
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by Greg McKaskle View Post
Be sure to read the documentation or description for the Get PWM function. Names can be misleading.

Greg McKaskle
Hi Greg, your post was linked to mine in the threaded view. But I assume your comment was for bharrison6, not me?

My post was not intended to endorse bharrison's inference that "Get PWM" is for decoding an input PWM signal... but rather the opposite. If I need to clarify my post please let me know and I will do so.


  #28   Spotlight this post!  
Unread 28-11-2014, 12:31
Zaque Zaque is offline
FF: Bobo Brigade
AKA: Zachary H.
FRC #3352 (Flaming Monkeys)
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2013
Location: Belvidere, Illinois
Posts: 91
Zaque has a spectacular aura aboutZaque has a spectacular aura aboutZaque has a spectacular aura about
Re: Swerve questions (Languages, CAN)

Quote:
Originally Posted by bharrison6 View Post
.
I thought you could use PWM to control a closed loop CAN but it turns out to be just quadrature that is supported. (Which is just 2 PWM signals plus an index signal)

...

2. PWM input from an absolute encoder will not work in a closed loop. 3. Analog input for an absolute encoder will not work in a closed loop. So my questions are. 1. Can you use quadrature input which is supported by a closed loop to get position of the pod? (I assume it would required a quick 360 at the beginning of the match to get the index and then just keep up with position from there) 2. If quadrature input to closed loop CAN will not work to control position, then what do swerve teams use? (If it isn't closed loop how do they deal with lag in the system?)
I wanted to mention something here to keep others from getting confused. I think when you say "closed loop" you are referring specifically to using the closed loop control on the speed controllers. However, any system that uses sensor feedback is closed loop, whether the feedback is on the speed controller, the roboRIO, or some other controller. So those sensor outputs are usable for closed loop control, just not on the speed controllers.
__________________
Zaque (Zach) H.
President
Programming/Electrical Lead
  #29   Spotlight this post!  
Unread 28-11-2014, 12:34
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Your encoder will need to be used with the FPGA or with interrupts in order for it to work properly. Your user code which runs on the CPU would need to run impractically fast to decode the encoder PWM.

You have a few options to try to decode this signal

You can do what Ether recommended, and try to use interrupts. This is likely more difficult than it sounds to get everything working properly. Also, interrupts and less commonly used features are likely the last priority of the roboRIO development team and beta testers, so you may encounter strange, hard to diagnose issues with interrupts.

You could also attempt to read the encoder on a separate device, like an arduino or basic stamp. There are likely software libraries that exist for reading an encoder like this already. If not, you could likely write your own using the "pulseIn()" function on the arduino. You can connect the arduino to the roboRIO through a serial connection very easily.
  #30   Spotlight this post!  
Unread 28-11-2014, 12:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Swerve questions (Languages, CAN)

Yes, Ether. I was responding to the OP. Sorry, but I don't use the threaded view and I simply clicked the Post button. I may need to pay more attention to that in the future.

Greg McKaskle
Closed Thread


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 02:16.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi