Continuous Servo Sample Labview Code for FTC Robotics
We are trying to use a continuous servo on our FTC team. The motor just runs and runs and never shuts off even when the programmed button is released. We see sample code for the 180 degree servos, but nothing for the continuous ones. Is there any sample code anywhere? Thanks.
Hi,
There is a dedicated discussion forum for FTC robotics which is located at https://decibel.ni.com/content/community/first/ftc
and monitored by other FTC teams and some dedicated R&D teams.
Thanks and have a great day!
Regards,
Dave C.
Applications Engineer
National Instruments
Similar Messages
-
Can some body help me to develop labview code for generating pulse to drive ac servo motor
can some body help me to develop labview code for generating pulse to drive ac servo motor... i am using NI 9401 card ....tnx
Driving an AC servo motor would (I missed AC on the previous msg) requires some complex hardware. This is generally done by drivers specifically designed for this purpose. I doubt you will be able to accomplish this with the hardware you currently have and it might be cheaper to just buy a driver for it and control the speed through the driver.
-
Visual C/C++ code/Labview code for interfacing NI Hardware
Hi,
i need Visual C/C++ code/Labview code for interfacing NI Hardware and sample project example.Duplicate - http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Visual-C-C-code-Labview-code-for-interfacing-...
You are just spamming now. -
Needs sample ABAP code for field routine
Dear Expert,
There is a field "Pay Scale Group" in my DSO which stores the data in the format
AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
I need to write a field routine on the transformation between DSO and Cube.
Can any one please help me with the sample ABAP code for this scenario.
Some more examples for better understanding of the requirement:-
Data in DSO(Source) Data in Cube(Target)
=================== ===================
AA1/B1/CCC2/DD2/EEE1 EEE1
AAA1/BB2/CC1/DDD3/EE2 EE2
A2/BBB2/CC2/DDD3/EEE5 EEE5
AA2/BB1/C1/DDD3/EE3 EE3
A3/B1/CC2/DDD1/EE4 EE4
Many thanks in advance.
Regards,
Prakash
Please do not dump your code requirements in SDN
Edited by: Pravender on May 18, 2011 11:37 AMHi,
You can use the following code :
Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
My assumption is that there will always be 4 '/'.
In the field routine write the below code
data: V1(5) type c,
V2(5) type c,
V3(5) type c,
V4(5) type c,
V5(5) type c.
data : VAR1 TYPE /BIC/OIZPAY_SGRP.
split VAR 1 at '/' into V1 V2 V3 V4 V5.
result = V5.
V5 will be having the characters after the last '/' .That is V5 = EEE1.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh
Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
Edited by: Ashutosh Singh on May 17, 2011 4:17 PM -
Need sample source code for calling stored procedure in Oracle
Hi.
I try to call stored procedure in oracle using JCA JDBC.
Anybody have sample source code for that ?
Regards, Arnold.Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
I have the Procedure defined as below in the SFCS1 package body
Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
BEGIN
Open O_Cursor FOR
SELECT CompanyId, CompanyName
FROM Company
WHERE CompanyProvince IN ('AL','AK');
END Company_Selection;
In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
DECLARE
A SFCS1.T_Cursor;
BEGIN
SFCS1.Company_Selection(A);
go_Block ('Block36');
The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause. -
Need Sample source code for Forum in jsp
Hi..
Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
thanx in advance
kumarHi..
Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
thanx in advance
kumar -
hello sir,i need labview code for a code which is written in matlab...
clc;
close all;
clear all;
Ez= zeros(1,200);
Hy=zeros(1,200);
Ca=1;
Cb=.4519;
n=1;
while(n<1500)
for k = 2:200
Ez(k)=Ez(k) + Cb*(Hy(k)-Hy(k-1));
end
Ez(1)=1;
for k=1:199
Hy(k)=Hy(k)+Cb*(Ez(k+1)-Ez(k));
end
plot(Ez,'b')
hold on
plot(Hy,'r')
hold off
pause(0.001);
n=n+1;
end
thankuWell, this code is quite trivial and if you have to learn LabVIEW anyway, you might as well try to implement it.
A few things to remember:
The first array element in LabVIEW has index #0, while in matlab it has index #1, so everything dealing with array indices needs to be adjusted slightly.
The zeroes function equivalent is "initialize array".
Keep the array in a shift register as you update elements.
use FOR loops.
Use one of the graphs to display the data.
LabVIEW Champion . Do more with less code and in less time . -
Labview code for closing the command window
Hi,
This is naveen.Actually we are using 3rd paty test software for our mobile hardware testing which creates an DOS or Command window after execution.We have automated to execute this software using labview.the problem we facing is that we couldn't run the test software unless we close or kill the dos window opened in the previous run.So i like to know whether you have any labview code for closing or killing the DOS window ,i request you help me in this regard.
regards,
NaveenUse the System Exec VI Owning Palette: Libraries & Executables VIs and Functions.
And take a look here http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/
Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far) -
Need help with Labview code for DAQmx
I'm currently trying to write Labview code for some thesis research and am having problems. I'm using the cDAQ 9172 with strain gage modules and two voltage input modules. I'll be reading/recording a voltage from an external source on one channel, while recording strains and accelerations with the other channels. I need to do all this simultaneously.
Everything I've done to this point has been in SignalExpress so I'm not sure how to program any of this. I also need to be able to calibrate the strain gages prior to each set of recordings. Any help you guys could offer would be greatly appreciated. Thanks.Hi,
I'm not sure how much this will help you, but I've attached a screen dump of code from a project I did that sounds pretty similar to what you're working on. The code is from a subVI that I used to create the daqMX measurement task for my data acquisition. I was also using a 9172. This was written in 8.5, but the only thing that you may not have access to is the functions for null offset and shunt cal of the strain gage channels. Hopefully this will at least get you started on your way to setting this up.
Andrew Carollo
Attachments:
create task.jpg 208 KB -
Dear fellow LabVIEW users,
I have found the LabVIEW codes for RTAI real time linux. But I cannot find any for RTlinux. I am wondering whether they can be used for RTlinux as well.
Your reply is highly appreciated.
Regards,
"LabVIEW user"Hi Balagyi2001,
Which codes do you refer to? We do have LabVIEW for Linux that
may or may not be compatible with certain kernels that have been made
to run more deterministically.
Richard
Field Sales Engineer, New Jersey
National Instruments -
Labview help for first robotics team 3959
I am from team 3959 in the first robotics competition and we are stumped on something and have been for a while. We are trying to make a code for a shooter(ran by a vex pro jaguar) that launches frisbees(go to the first website for more info.) and a servo code(a vex pro servo) both in a Teleop.vi but although they have no code in common they conflict. the shooter code works fine as does the servo but if used at the same time the shooter runs a full neutral. I have added pictures of both codes to show. one is labeled working servo the other is a jaguar code. please if anyone could possibly help it would be great
-Joseph (proud head programming student of 3959)
Attachments:
labview.docx 352 KBQuestions about FRC should be posted in the FIRST Robotics Competition Community.
Please don't use Word documents for screenshots. Paste the screenshot into mspaint and save as a PNG, or even better, upload your code as an attachment. I'm an experienced FRC mentor and I still can't figure out what's going on in your screenshot because so much is crossed out and circled. Possibly the problem is that the servo code runs in a loop - why is it in a while loop? There's already a while loop further up in the code; if you put a loop like that inside your code, it will prevent the main loop from repeating until the inside loop finishes, which means anything else that is supposed to run repeatedly will run only once (until the servo loops stops; then it will run again one time and the servo loop will restart, etc.) -
Need help with LabVIEW code for motor control.
Hi,
My name is Sasi. I am a BME grad student working on my thesis topic of evaluating spine implants for low back pain. For this I am building a test machine that would apply pure moments to a spine specimen. I am using LabVIEW 8.5 to implement control of a brushless AC servo motor. My requirement is,
Step 1: Initialize the motor.
Step 2: Start moving it at a uniform RPM to the right (This RPM value too user can enter).
Step
3: While doin Step 2; simultaneously read torque cell data (Using DAQ
asst.). DAQ o/p is from 0 V to 10 V; 0 V being -10 Nm n
10 V being +10 Nm
Step 4: When Torque value reaches +10 Nm, i.e 10 V, the motor stops.
Step
5: From the position where motor stopped (i.e no need to reset to
initial position) Start moving in the opposite direction at the same
uniform RPM as in Step 2 while reading torque cell data.
Step 6: Once again when torque reaches -10 Nm, i.e. 0 V, the motor should stop.
Step 7: Repeat 'Step 2' to 'Step 6' 3 times.
Step 8: Reset motor postion.
Till now I have managed to get the motor to move forward n backward @ a desired vel, accl, n deceleration for 3 cycles. I am attaching my code. I am having problem inserting the code for reading DAQmx amidst all this. Can anyone help me out.
Thnks,
Sasi.
Solved!
Go to Solution.
Attachments:
Test_012609.vi 35 KBHi Sasidhar,
I took a look at your problem and I think I have a workable solution for you. I definitely agree with Lynn's suggestion of using parallel loops. This will allow the DAQmx portion to run uninhibited by the motion portion, and vice versa. Plus, you only need to iterate the motion loop whenever the voltage level crosses a threshold. So, by iterating on the motion code in the same loop that you are iterating on DAQmx code, you are essentially wasting processor.
I created a VI that should do what you are wanting. I tested it out myself and it works great. You might have a tweak a few things to apply to your system (like motion board ID and DAQmx physical channel, etc.). I used two parallel loops and event-based programming. Basically the motion loop starts the motor spinning at the specified velocity. Once the motor is spinning, it waits for the DAQmx loop to tell it that the voltage value has crossed the threshold. When the voltage value exceeds the maximum threshold (which I set to a value slightly less than 10 to allow for jitter and saturation), the DAQmx loop signals the motion loop that it can finish its iteration. The motion loop stops the motion, reverses the direction, and starts the motion again. Once motion has started, it again waits for the DAQmx loop to tell it that a threshold has occurred, but this time, it is looking for a minimum threshold. I used "Occurrences" to implement the event-based programming in LabVIEW.
I have commented the code rather thouroughly, so hopefully the comments will answer any remaining questions. The benefit of using event-based programming for this is that you save processor time, and your motion is more closely synchonized with the DAQmx. Instead of iterating the motion loop as fast as you can, checking for updates each time, you just pause it, and wait for the other loop to tell you when to start up again. In the mean time, the processor doesn't have to worry about iterating that loop over and over again. Also, when the occurrence does occur, you catch it immediately, instead of having to wait until the next iteration. Thus, you are more closely synchronized with the DAQmx portion of the code.
I hope this will help you. Please post back if you have any questions about the code or its implementation. Good Luck!
Message Edited by Wes P on 02-03-2009 05:18 PM
Wes P
Certified LabVIEW Developer
Attachments:
Motion and DAQ.vi 59 KB
DAQmx Loop.png 24 KB
Motion Loop.png 17 KB -
Sample source code for fields mapping in expert routine
Hi All
Iam writing the expert routine from dso to cube for example I have two fields in dso FLD1,FLD2
same fields in infocube also ,can any body provide me sample abap code to map source fields to target fields in expert routine,your help will be heighly appreciatble,it's an argent.
regards
eliazBasic would be ;
RESULT_FIELDS -xxx = <SOURCE_FIELDS> -xxx
you have the source fields as source, and result fields for as the target. In between you can check some conditions as in other routines of transformation.
BEGIN OF tys_SC_1, shows your source fields ( in your case DSO chars and key figures)
BEGIN OF tys_TG_1, , shows your result fields ( in your case Cube characteristics)
Hope this helps
Derya -
Sample ABAP code for userexits, and calling bapi's
Hi,
Can someone please send me sample ABAP code
1) to do extractor enhancement using user exit.
2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
Thank you very much in advance and appreciate any help.
Regards
Prasadhai ,
check this code...
*& Tables
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
*& Selection Screen Parameters
selection-screen begin of block a01 with frame title text-001.
selection-screen skip.
parameters : p_tcode like tstc-tcode obligatory.
selection-screen skip.
selection-screen end of block a01.
*& Start of main program
start-of-selection.
Validate Transaction Code
select single * from tstc
where tcode eq p_tcode.
Find Repository Objects for transaction code
if sy-subrc eq 0.
select single * from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir
where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir
where pname = tstc-pgmna.
select single * from enlfdir
where funcname = tfdir-funcname.
select single * from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
Find SAP Modifactions
select * from tadir
into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct
where sprsl eq sy-langu
and tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
Take the user to SMOD for the Exit that was selected.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen. -
Sample Bapi code for creating orders
HI all,
ive been working on creating an order using idoc_input_orders and couldnt do it because of 2 fields. now changed my decission and thinking of writing a bapi to do the same. has anybody got the sample code for mapping and filling in the bapis before calling bapi for creating an order. Could somebody help me with a sample code and i could use it as a reference before starting coding.
thanks,
KiranSee if this helps.
one order with total sum of effort
clear: l_order_header,
l_salesdocument,
l_order_partners,
l_order_items,
l_order_schdl.
refresh: it_order_items,
it_order_partners,
it_order_schdl,
it_return.
???????? get from material ...
Order header
l_order_header-doc_type = 'ZQBV'.
l_order_header-distr_chan = '10'.
l_order_header-division = '00'.
if g_qals-werk eq '1100'.
l_order_header-sales_org = '1000'.
else.
if g_qals-werk eq '3100'.
l_order_header-sales_org = '3000'.
else.
message i001(00) with text-005.
endif.
endif.
l_order_header-purch_no_c = g_qals-prueflos. " <= lot
Partner data
l_order_partners-partn_role = 'AG'.
l_order_partners-partn_numb = g_qals-kunnr.
append l_order_partners to it_order_partners.
Order items => only one
l_order_items-itm_number = 10.
l_order_items-material = g_qals-matnr.
l_order_items-target_qty = 1.
append l_order_items to it_order_items.
Schedules for quantity
l_order_schdl-itm_number = 10.
l_order_schdl-req_qty = 1. " <= only 1 !
append l_order_schdl to it_order_schdl.
Conditions for value
l_order_conditions-itm_number = 10.
l_order_conditions-cond_type = 'PR00'.
l_order_conditions-cond_value = g_effort_sum.
l_order_conditions-currency = g_effort_unit.
append l_order_conditions to it_order_conditions.
BAPI to create sales order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = l_order_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = l_salesdocument
TABLES
RETURN = it_return
ORDER_ITEMS_IN = it_order_items
ORDER_ITEMS_INX =
ORDER_PARTNERS = it_order_partners
ORDER_SCHEDULES_IN = it_order_schdl
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN = it_order_conditions
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
if not l_salesdocument is initial.
order successfully created
message i001(00) with text-001 l_salesdocument.
endif.
endif.
Maybe you are looking for
-
Is there a way to run dos commands on onther system?
Hi I have connected to a port of another system where windows is the operating system. So can I run dos commands on the other system through that network connection from my computer?
-
IPOD TOUCH MY HOTMAIL DOES NO LONGER EXIST
Yes since I added my hotmail account to my ipod when ever I try and sign into my hotmail address it says microsoft account does not exist. I can't login to my hotmail address that I have had for over 10 years. It's almost like it's been deleted! All
-
Error during restore/recovery and 'open resetlogs'
Hello forum. I'm attempting to restore a database to a new host and have run into an error during the opening of the database (with resetlogs). The renaming of the datafiles, restore, switching of datafiles, and recovery are all done by an rman scrip
-
Hello, It might sound silly but I have a problem. By default the SharePoint adds a search box next to the views, in order to be able to search documents within the current list. In the beginning it was working but some reason, I don't know why, it st
-
Macbook Pro - Kernal Crash when using browsers (Safar, Firefox, etc.)
A couple of days ago my computer started giving me the dreaded Kernel crash (You need to restart your computer. Hold the Power button for several seconds or press the Restart button.) whenever I browsed the internet. I tried using different browsers,