Step 2: All the PMC controls are functions for the VIs block diagram. Open the block diagram by clicking Window -> Show Block Diagram
Step 3: Open the functions palette by right clicking blank space in the block diagram or clicking View -> Functions Palette
Step 4: In the functions palette, click Connectivity -> .NET -> Constructor Node
Step 5: Double click on the empty .NET constructor block to select the .NET class to construct
Step 6: In the Select .NET Framework Constructor, click on the Browse button. In the file browser, select the PMCLIB.dll and click OK
Step 7: In the Objects pane, expand the PMCLIB, select “SystemCommands” and click OK
Step 8: To call a function from the SystemCommands class, right click it and click Create -> Method for PMCLIB.SystemCommands Class -> function name. You will want to start with AutoSearchAndConnectToPMC or ConnectToSpecificPMC. Connect the top right reference output of the constructor to the reference input of the function invoker block. Then connect the bottom right error output to the error input of the invoker block
Step 9: After connecting to the PMC, you will need to gain mastership. The GainMastership() function is in the SystemCommands class
Step 10: After wiring the GainMastership block, create a constructor block for a XbotCommands class
Step 11: Just like with SystemCommands, double click the constructor block, select the PMCLIB -> “XBotCommands” and click OK
Step 12: Connect the error out of the GainMastership invoke block to the error in of the XBotCommands constructor. This will ensure that the XBotCommand function calls will happen after the ConnectToPMC() and GainMastership() function calls
Step 13: Call a function from the XbotCommands class by right clicking on the XbotCommands constructor or selecting Create -> Method for PMCLIB.XBotCommands Class -> function name. Connect the reference in/out and the error in/out.
Step 14: Please note that the error out of the invoker block just tells if the function call was invoked from the DLL. It does not tell you if the function call encountered a non-fatal error. To tell if a command is accepted, you will need to look at the output values of the function.
For example, calling the LevitationCommand() function with an xbotID of -10 will not result in a fatal error in the function so the error out says no error. However, an xbotID of -10 is not allowed in the PMC, so the return will show an error code of INVALIDPARAMS.
Step 15: To access elements of a structure output from a function call, right click on the right end for the return output and select Create -> Property for <structure name> and choose the element you want
Step 16: Then wire the property block to the return output of the function block that returns a structure
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.