Exemplo n.º 1
0
  static void Main (string[] args)
  {
    bool dll = args.Length > 0 && String.Compare(args[0], "dll") == 0;
    if (dll) {
      _error   = "#ERROR [JACO]: ";
      _info    = "#INFO  [JACO]: ";
      _warning = "#WARNING [JACO]: ";
    }

    try {
      _jaco = new CJacoArm(Crypto.GetInstance().Encrypt("C6H12O6h2so4"));
      Console.WriteLine(_info + "Successfully connected to Jaco.");
    } catch (CAccessDeniedException) {
      Console.WriteLine(_error + "Access to Jaco denied. Please check password and USB connection.");
      return;
    } catch (Exception) {
      Console.WriteLine(_error + "Could not connect to Jaco.");
      return;
    }

    _cmd = new CJoystickValue();
    _zones = _jaco.ConfigurationsManager.GetProtectionZones();
    _jaco.ControlManager.StartControlAPI();
    _api = true;
    _data = new float[37];
    for (int i=0; i<37; i++) _data[i] = 0f;

    if (dll) {
      Console.WriteLine(_info + "Active protection zones: " + _zones.NbZoneActive);
      return;
    }

    TerminalCommand(args);
    Deinit();
  }
Exemplo n.º 2
0
 //Constructor
 public ExampleProgram() 
 {
     try
     {
         //Initialize JACO Object with an encrypted valid password
         jaco = new CJacoArm(Crypto.GetInstance().Encrypt(m_APIpass));
     }
     catch(CAccessDeniedException ex)
     {
         throw ex;
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            bool dll = args.Length > 0 && String.Compare(args[0], "dll") == 0;

            if (dll)
            {
                _error   = "#ERROR [JACO]: ";
                _info    = "#INFO  [JACO]: ";
                _warning = "#WARNING [JACO]: ";
            }

            try {
                _jaco = new CJacoArm(Crypto.GetInstance().Encrypt("C6H12O6h2so4"));
                Console.WriteLine(_info + "Successfully connected to Jaco.");
            } catch (CAccessDeniedException) {
                Console.WriteLine(_error + "Access to Jaco denied. Please check password and USB connection.");
                return;
            } catch (Exception) {
                Console.WriteLine(_error + "Could not connect to Jaco.");
                return;
            }

            _cmd   = new CJoystickValue();
            _zones = _jaco.ConfigurationsManager.GetProtectionZones();
            _jaco.ControlManager.StartControlAPI();
            _api  = true;
            _data = new float[37];
            for (int i = 0; i < 37; i++)
            {
                _data[i] = 0f;
            }

            if (dll)
            {
                Console.WriteLine(_info + "Active protection zones: " + _zones.NbZoneActive);
                return;
            }

            TerminalCommand(args);
            Deinit();
        }
Exemplo n.º 4
0
        public JacoArm(string key)
        {
            m_IsEnabled = false;
            m_State     = new JacoArmState();
            m_Cmd       = new CJoystickValue();

            try
            {
                CCypherMessage pass = Crypto.GetInstance().Encrypt(key);
                m_Arm = new CJacoArm(pass);


                Console.WriteLine("Wrapper initialized.");
                if (m_Arm.JacoIsReady())
                {
                    m_Arm.ControlManager.StartControlAPI();
                    // Init sequence, place the arm in READY position.
                    InitSequence();

                    Console.WriteLine("The arm is ready.");
                    m_IsEnabled = true;
                }
                else
                {
                    Console.WriteLine("The arm is not ready!");
                    m_IsEnabled = false;
                }
            } catch (Exception e)
            {
                System.Console.WriteLine(
                    "JACO API initialisation failed. Reason: ");
                System.Console.WriteLine(e.ToString());
                m_IsEnabled = false;
            }

            // 200 ms delay.
            m_WatchDogDelay = new TimeSpan(0, 0, 0, 0, 200);
        }
    public CJacoArm init()
    {
        const string MyValidPassword = "******";

        pointTraj = new CTrajectoryInfo();

        try
        {
            Jaco = new CJacoArm(Crypto.GetInstance().Encrypt(MyValidPassword));
            Jaco.ControlManager.StartControlAPI();
        }
        catch (Exception ex)
        {
            Logger.addLog("Error initializing Jaco!\n" + ex.Message, true);
            return(Jaco);
        }

        if (Jaco.JacoIsReady())
        {
            CClientConfigurations config = new CClientConfigurations();

            config.ClientName      = "Arup";
            config.MaxAngularSpeed = 0.2f;
            config.Organization    = "SV";
            Jaco.ConfigurationsManager.SetClientConfigurations(config);

            Jaco.ControlManager.EraseTrajectories();

            Logger.addLog("Jaco initialized and ready");
            return(Jaco);
        }
        else
        {
            Logger.addLog("Jaco initialized but not ready", true);
            return(Jaco);
        }
    }
    public void Delay(CTrajectoryInfo point, CJacoArm jArm)
    {
        float        J1, J2, J3 /*, J4, J5, J6, F1, F2, F3*/;
        int          k           = 0;
        int          jacoTimeout = 0; //max delay timeout for jaco to track arm
        CAngularInfo info;
        float        thresh = 6;

        do
        {
            try
            {
                info = jArm.ControlManager.GetPositioningAngularInfo();
            }
            catch (Exception)
            {
                Logger.addLog("Error in obtaining Jaco current angles", true);
                return;
            }

            J1 = Math.Abs(info.Joint1 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_1]);
            J2 = Math.Abs(info.Joint2 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_2]);
            J3 = Math.Abs(info.Joint3 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_3]);
            // J4 = Math.Abs(info.Joint4 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_4]);
            // J5 = Math.Abs(info.Joint5 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_5]);
            // J6 = Math.Abs(info.Joint6 - point.UserPosition.AnglesJoints.Angle[CVectorAngle.JOINT_6]);
            // F1 = Math.Abs(info.Finger1 - point.UserPosition.FingerPosition[0]);
            // F2 = Math.Abs(info.Finger2 - point.UserPosition.FingerPosition[1]);
            // F3 = Math.Abs(info.Finger3 - point.UserPosition.FingerPosition[2]);
            k++;
        }while (k < jacoTimeout && !((J1 < thresh) && (J2 < thresh) && (J3 < thresh) /* && (J4 < 2.00)) && (J5 < 2.00)) && (J6 < 2.00)*/));
        if (k >= jacoTimeout)
        {
            Logger.addLog("Timeout of " + jacoTimeout.ToString() + " loops exceeded");
        }
    }
Exemplo n.º 7
0
        public JacoArm(string key)
        {
            m_IsEnabled = false;
            m_State = new JacoArmState();
            m_Cmd = new CJoystickValue();

            try
            {
                CCypherMessage pass = Crypto.GetInstance().Encrypt(key);
                m_Arm = new CJacoArm(pass);

                Console.WriteLine("Wrapper initialized.");
                if (m_Arm.JacoIsReady())
                {
                    m_Arm.ControlManager.StartControlAPI();
                    // Init sequence, place the arm in READY position.
                    InitSequence();

                    Console.WriteLine("The arm is ready.");
                    m_IsEnabled = true;
                }
                else
                {
                    Console.WriteLine("The arm is not ready!");
                    m_IsEnabled = false;
                }
            } catch (Exception e)
            {
                System.Console.WriteLine(
                    "JACO API initialisation failed. Reason: ");
                System.Console.WriteLine(e.ToString());
                m_IsEnabled = false;
            }

            // 200 ms delay.
            m_WatchDogDelay = new TimeSpan(0,0,0,0,200);
        }
Exemplo n.º 8
0
		public MyJacoArm(string key)
        {
            try 
            {
                CCypherMessage pass = Crypto.GetInstance().Encrypt("C6H12O6h2so4");
				
                m_Arm = new CJacoArm(pass);					
				
                System.Console.WriteLine("C# Wrapper initialized.");				
                System.Console.Write("JACO version: ");
                System.Console.WriteLine(m_Arm.ConfigurationsManager.GetCodeVersion()[0].ToString("X1"));
				
				m_RetractDelay = new TimeSpan(0,0,0,24,0); // 8 secs.	
				
				for(int i = 0; i < 6; i++)
				{
					addposevalue[i] = 0.0f;
					addjointvalue[i] = 0.0f;
				}
				
				// erasing trajectories
				m_Arm.ControlManager.EraseTrajectories();
				// deleting the previous error log
				m_Arm.DiagnosticManager.DataManager.DeleteErrorLog();

				// set the arm flag to true 
				m_IsEnabled = true;
								
            } 
			catch (Exception e)
            {
                System.Console.WriteLine("JACO API initialisation failed. Reason: ");
                System.Console.WriteLine(e.ToString());
				// set the arm flag to false 
				m_IsEnabled = false;
            }
        }	
Exemplo n.º 9
0
	private void DataInitialization()
	{
		try
		{
			jaco = new CJacoArm(Crypto.GetInstance().Encrypt("C6H12O6h2so4"));
			jaco.GetAPIVersion();
			m_OutConnectionStatus.Text = "Jaco is connected.";
		}
		catch(Exception err)
		{
			m_OutConnectionStatus.Text = "Jaco is not connected or your password is invalid. Reason: \n" + err.ToString();
		}
		
		m_CurrentClientConfig = new CClientConfigurations();
	}
Exemplo n.º 10
0
	private void DataInitialization()
	{
		try
		{
			jaco = new CJacoArm(Crypto.GetInstance().Encrypt("C6H12O6h2so4"));
			m_OutConnectionStatus.ModifyFg(StateType.Normal, m_ColorConnectionOpened);
			m_OutConnectionStatus.Text = "Jaco is connected.";
		}
		catch(Exception ex)
		{
			m_OutConnectionStatus.Text = "Jaco is not connected.";
		}
	}