verifyApp.cpp

This sample code performs a check on the SynqNet Configuration and the configuration of only the 1st node in the system.

/* verifyApp.cpp

Copyright(c) 1998-2009 by Robotic Systems Integration, Inc. All rights reserved.
 This software contains proprietary and confidential information of Robotic 
 Systems Integration, Inc. (RSI) and its suppliers. Except as may be set forth 
 in the license agreement under which this software is supplied, disclosure, 
 reproduction, or use with controls other than those provided by RSI or suppliers
 for RSI is strictly prohibited without the prior express written consent of 
 Robotic Systems Integration.

 This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) 
 prior to running this program so that the motor can rotate in a stable manner.

 ApplicationVerification.cpp: Performs a check on the SynqNet Configuration and the 
 configuration on only the 1st node in the system. Would show better result if the 1st node
 were connected to an axis instead of SLICE I/O.

For any questions regarding this sample code please visit our documentation at www.roboticsys.com
or call us at (312)727-0080.

Warning!  This is a sample program to assist in the integration of your motion 
 controller with your application.  It may not contain all of the logic and safety
 features that your application requires.
*/

#include "rsi.h"

using namespace RSI::RapidCode::SynqNet;

#define AXIS_NUMBER                         0

void verifyAppMain()
{
    try
    {
        MotionController       *controller ;
        Axis             *axis ;

        // initialize MotionController class
        controller = MotionController::CreateFromBoard(0);   
        
        // initialize Axis class  
        axis = controller->AxisGet( AXIS_NUMBER);

    //Disable the amplifier
    axis->AmpEnableSet(false);

    printf("Application Verification::::::\n\n");
    
    //ALWAYS CHECK
    // Identifies the network topology
    if(controller->SynqNetNetworkTypeGet() == RSINetworkTypeRING)
    {
      printf("Network topology:           RING \n\n");
    }

    if(controller->SynqNetNetworkTypeGet() == RSINetworkTypeSTRING)
    {
      printf("Network topology:           STRING \n\n");
    }
    
    // SynqNet Node Count - Make sure the number of expected nodes are found during the Discovery phase
    printf("SynqNetNodeCountGet:            %ld \n\n", controller->SynqNetNodeCountGet());

    // SqNode Node Type and Option - Make sure the nodes are discovered in the proper order and 
    // are of the expected hardware TYPE and OPTION
//    printf("SqNodeTypeGet:              0x%x \n\n",axis->SqNode->TypeGet());
//    printf("SqNodeOptionGet:            0x%x \n\n",axis->SqNode->OptionGet());

    // SqNode FPGA Type - Identifies whether the FPGA image is a Boot or Runtime
    if(axis->SqNode->FPGATypeGet() == RSISqNodeFpgaTypeRUN_TIME)
    {
      printf("This SqNode uses following FPGA image:        Runtime Image\n\n");
    }
    
    if(axis->SqNode->FPGATypeGet() == RSISqNodeFpgaTypeBOOT)
    {
      printf("This SqNode uses followsing FPGA image:       Boot Image, factory default\n\n");
    } 

    // FPGA VendorDevice - Identifies the FPGA image
    printf("SqNodeFPGAVendorGet:            0x%x \n\n",axis->SqNode->FPGAVendorGet());

    // SqNode FPGA Version - Make sure the FPGA version is up to date with the software version
    printf("SqNodeFPGAVersionGet:           0x%x \n\n",axis->SqNode->FPGAVersionGet());

    // SqNode Exact Match - Identifies whether or not the software exactly knows the node type 
    // and FPGA image combination
    if((bool)axis->SqNode->ExactMatchGet() == true)
    {
      printf("This SqNode exactly matches the software version\n\n");
    }

    // SqNode Motor Count and Offset - The number of motors per node and their offsets
    printf("SqNodeMotorCountGet:            %ld \n\n",axis->SqNode->MotorCountGet());
    printf("SqNodeMotorOffsetGet:           %ld \n\n",axis->SqNode->MotorOffsetGet());
        
    // SqNode Drive Firmware Version - Make sure the drive firmware version is correct for your application
        printf("MPIFirmwareVersionGet:\t            %ld \n\n", controller->MpiFirmwareVersionGet());

    // SqNode Switchld
    printf("SqNodeSwitchIDGet:            0x%x \n\n",axis->SqNode->SwitchIDGet());

    //OPTION INFORMATION TO CHECK
    // SqNode Node Name - Text string used to identify the Node Type
    printf("SqNodeNameGet:              %s \n\n", axis->SqNode->NameGet());

    // SqNode Model Number - Identifies the particular node model number.
    printf("SqNodeModelNumberGet:           %s \n\n",axis->SqNode->ModelNumberGet());
    // SqNode Serial Number - Identifies the particular node serial number.
    printf("SqNodeSerialNumberGet:            %s \n\n",axis->SqNode->SerialNumberGet());

        // SqNode Unique - The Node Type, Option, and Unique values will always uniquely identify 
    // every SynqNet node
    printf("SqNodeUniqueIDGet:            0x%x \n\n",axis->SqNode->UniqueIDGet());

    // SqNode Drive Count - Identifies the number of drives on a node
    printf("SqNodeDriveCountGet:            %ld \n\n",axis->SqNode->DriveCountGet());
    }
    catch (RsiError *err)
    {
        printf("%s\n", err->text);
    }
}