|
|
|
![]() |
|
|||||||
|
||||||||
The 2015 Driver Station discontinued support for quadrature encoder inputs via the Cypress pSOC. This paper provides a detailed description for the equivalent functionality using the TI LaunchPad from the 2015 KOP.
This document briefly describes the motivation for and implementation of a quadrature encoder-based operator input for the 2015 Driver Station. This solution uses the TI LaunchPad included in the 2015 KOP. It presents a detailed set of software modifications to the LaunchPad FRC code to enable use of a FANUC CNC encoder wheel. Also included is example LabVIEW code for extracting the encoder data using the roboRIO.
TI LaunchPad Encoder Support.pdf
12-03-2015 07:22
KMBruggemanI think I was able to follow most of this but did have some follow-up questions. Though I'm not as experience in looking at the launchpad code or using eclipse.
Looking at the example code:
P1IE basically enables the interupt
P1IES enables interupt edge select
It appears that we are limited to just P1 and P2,e.g. we could add a second encoder with P2IE and P2IES?
Additionally, to map that to a button 2.2 and 2.7 we could reference bits 2 & 7 respectively?
To output it then could I use the other 16 BITS for the buttons out?
Finally, is there the ability to pass additional encoder counts so long as we did not exceed the current draw of the launchpad?
For example could I run an interrupt on P3 using 3.2 and 3.6?
Would I just implement that by passing an integer vs a float for an axis value?
Thanks for any help, my sum total of knowledge is thus far based upon your team's paper and Google. (http://courses.cs.washington.edu/cou...pts-posted.pdf)
12-03-2015 09:06
ayeckley| It appears that we are limited to just P1 and P2,e.g. we could add a second encoder with P2IE and P2IES? |
| Additionally, to map that to a button 2.2 and 2.7 we could reference bits 2 & 7 respectively? |
| To output it then could I use the other 16 BITS for the buttons out? |
| Finally, is there the ability to pass additional encoder counts so long as we did not exceed the current draw of the launchpad? For example could I run an interrupt on P3 using 3.2 and 3.6? |
| Would I just implement that by passing an integer vs a float for an axis value? |
12-03-2015 09:53
marshallVery cool! Good work folks! Thank you for sharing this!
12-03-2015 19:04
KMBruggemanSo, one more question. (it's essentially my rookie year so I get unlimited questions right?) How would I run multiple interrupts or Port 1 would I just change different BITs (vs BIT 4 and 5 as shown in your example)?
13-03-2015 10:20
ayeckley|
So, one more question. (it's essentially my rookie year so I get unlimited questions right?) How would I run multiple interrupts or Port 1 would I just change different BITs (vs BIT 4 and 5 as shown in your example)?
|
13-03-2015 13:24
KMBruggemanThanks again for the reply. We are in a frenzy as well as our regional is next week.
That being said from a Labview post programming of the Launchpad, do you know of anyway I can read what the Launchpad is outputting to the USB port of the driver station (pre-processing).
Would I just use a USB sniffer? Additionally, IIRC if I put the reading routine in a custom dashboard I should be able to run it and check it's operation without having to connect the robot (real or otherwise simulated) right?
I spent a good amount of time on it last night and may post some snippets later on if I don't make more progress after looking at the user guide.
Cheers!
13-03-2015 14:06
ayeckley|
do you know of anyway I can read what the Launchpad is outputting to the USB port of the driver station (pre-processing)
|
13-03-2015 14:30
KMBruggemanThat is what I was thinking - and since I have a custom dashboard was attempting to just put the custom Labview code with indicators on the "custom" tab of the dashboard to output the buttons and the encoder count.
I figured since I could see the buttons lighting up at the bottom of the driver station and in my custom dashboard I should be able to read that input without actually running "main.vi" to either a live robot or a simulated robot (to help out my old and wheezing processor).
I'm not seeing the button outputs though and when I tried to tie into the data stream that is on the standard dashboard project I was not getting anything from the Launchpad (My process is 1 encoder then modify to get a 2nd and if I have any hair and patience left maybe a 3rd).
That being said I am looking to see if there's a way I can "see" what's happening along the process to troubleshoot. (Similar to my cheap way of putting "Alert('here');" when doing poor man's javascript troubleshooting to see where the process is breaking down.
I see three critical places I would like to check thus far.
1 - Can I tell what software is actually loaded on the Launchpad? (Validate the software install) Currently when I use the little debug button I am getting HW stops where I have a steady red LED and I have to restart the Launchpad via unplugging/plugging it in. When setting the OPTION2 and OPTION3 flag it does show with the appropriate # of buttons afterwards via a Labview Custom DB.
2 - Is the Launchpad actually calculating a value for "encoder_count" and what is it? (Can I see this by using a tool in CCS?)
3 - What is the Launchpad sending via "gamepadReportTX.buttons"?
(Could I see this on my laptop with another tool? I would guess that I could use the LabView Custom Dashboard for this)
I know that's a bit lengthy but hopefully clears things up.
Also if I wanted to use say P1.3 and P1.2 would I need to delete them from the "Indicators" section of "OPTION1" in hal.c and replace two of the dummy inputs after P1.4 in the buttons section? e.g.
#define NUM_BUTTONS 32
#define NUM_INDICATORS 9
{GPIO_PORT_P1, GPIO_PIN4},
{GPIO_PORT_P1, GPIO_PIN3},
{GPIO_PORT_P1, GPIO_PIN2},
... dummy inputs ...
Thanks again for explaining this. If it would be easier I can provide a phone #.
Kurt
13-03-2015 14:54
wt200999I do not know if the HID data is transmitted from the driver station to the dashboard but I do not think it is. What are you planning on using the encoders for?
Another way you can consider for transmitting the data is to use serial on the dashboard and keep the HID to the driver station. The LaunchPad has a USB hub, so the debugger chip can also act as a USB <--> Serial bridge, and you can look at both the HID and the serial stream at the same time. You will just need to write software on the dashboard to detect and decode the serial stream.
13-03-2015 15:00
KMBruggemanThe plan is to use it for arm control. The robot has the equivalent of a human arm from the shoulder to the wrist with the same joints. The plan is to have a scale version at the driver station to use to control it's movement so it's less clumsy than say driving a backhoe. (sp?)
I'll have to take a look at the reading in the serial stream (I assume it's more complicated than the standard create a constant for "USB0" ...)
13-03-2015 16:00
KMBruggemanAs I was meandering through the code this afternoon I had this random thought. It looks the axis values are defined in "USB_gamepad.h" source such that they are contained in the data structure "USB_GamepadReportTx".
https://github.com/TI-FIRST/MSP430-G.../USB_gamepad.h
If I look at that it appears that *.ax, *.ay, etc are all 16bit integers. Could I modify the code from https://github.com/TI-FIRST/MSP430-G...b/master/hal.c (line 517)
from: "gamepadReportTx.ax = Convert8Bit(ADC12_A_getResults(ADC12_A_BASE, ADC12_A_MEMORY_12));"
to "gamepadReportTx.ax = encoder_count;" as that would allow me in essence to have up to 8 x 16BIT signed integers in my HID data stream?
(gamepadReportTx is defined on line 151 to type USB_GamepadReportTX from the first linked file.)
I would then just need to see how LV views/processes that data converting it into a float with the range -1.0 to 1.0 but my guess would be by dividing it by 2^15 ...
Am I totally off base here or is my lack of sleep starting to pay off?
13-03-2015 16:12
ayeckley|
If I look at that it appears that *.ax, *.ay, etc are all 16bit integers. Could I modify the code from https://github.com/TI-FIRST/MSP430-G...b/master/hal.c (line 517)
from: "gamepadReportTx.ax = Convert8Bit(ADC12_A_getResults(ADC12_A_BASE, ADC12_A_MEMORY_12));" to "gamepadReportTx.ax = encoder_count;" as that would allow me in essence to have up to 8 x 16BIT signed integers in my HID data stream? |
13-03-2015 16:46
wt200999|
The plan is to use it for arm control. The robot has the equivalent of a human arm from the shoulder to the wrist with the same joints. The plan is to have a scale version at the driver station to use to control it's movement so it's less clumsy than say driving a backhoe. (sp?)
|
13-03-2015 16:51
ayeckleyBig Picture Thought first: If you are intending to control a jointed arm, it might make more sense to use potentiometers and the analog inputs on the Launchpad instead of quadrature encoders. You wouldn't have to modify the default FRC Launchpad code to do that. You could just go directly to the Ax, Ay, Az etc. inputs.
|
I figured since I could see the buttons lighting up at the bottom of the driver station and in my custom dashboard I should be able to read that input without actually running "main.vi" to either a live robot or a simulated robot (to help out my old and wheezing processor).
|
| I'm not seeing the button outputs though and when I tried to tie into the data stream that is on the standard dashboard project I was not getting anything from the Launchpad. |
| 1 - Can I tell what software is actually loaded on the Launchpad? (Validate the software install) Currently when I use the little debug button I am getting HW stops where I have a steady red LED and I have to restart the Launchpad via unplugging/plugging it in. |
| 2 - Is the Launchpad actually calculating a value for "encoder_count" and what is it? (Can I see this by using a tool in CCS?) |
| Could I see this on my laptop with another tool? I would guess that I could use the LabView Custom Dashboard for this |
| Also if I wanted to use say P1.3 and P1.2 would I need to delete them from the "Indicators" section of "OPTION1" in hal.c and replace two of the dummy inputs after P1.4 in the buttons section? |
13-03-2015 22:47
KMBruggemanI also was pushing for the potentiometer solution but it met with much resistance based upon the idea that it would be less precise.
In any case I have posted the code in .zip file here. I commented out some ideas I had and tried to run it as pure to your example.
https://onedrive.live.com/redir?resid=94CA3E1384343D7D!1159&authkey=!AM07Cq1 eGOhWI68&ithint=file%2czip
Here's some screen shots below of the HW Breakpoints
https://onedrive.live.com/redir?resi...nt=photo%2cPNG
https://onedrive.live.com/redir?resi...nt=photo%2cPNG
kmbworkemail@gmail.com
14-03-2015 09:18
KMBruggemanI was planning on resetting to a known home position to re-zero required. When doing so I would re-zero the encoders on the robot and essentially us the current encoder count from the launchpad as the new 0 ref point.
14-03-2015 10:20
Steven Smith| I also was pushing for the potentiometer solution but it met with much resistance |