Omron HVC-P2 (Second Camera) icon Omron HVC-P2 (Second Camera) — Windows ARC plugin for Omron HVC-P/HVC-P2: Python-based face/body/hand detection, gaze, age/gender, expressions and recognition; dual-camera support. Try it →
Asked — Edited
Can someone help me with the development of a ARC skill?

Can Someone Help Me With The Development Of A ARC Skill?

Can someone help me with the development of a ARC skill?  I have put together a Arduino script that is for an ESP32 it contains the EZB firmware and it also has a very robust MPU6050 logic.  I need to have the skill in ARC be able to allow some options to be set and also bring MPU data back in variables.  Like I said I have all the logic I just need help making the UI for ARC.   

If you are willing to help let me know and I will send you the code.


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#33  

In arduino youre converting to a signed in 

in robot skill you’re converting the data to unsigned int 

change BitConverter.ToUInt16 

Your debug is probably because the checkbox isn’t checked. You have an IF condition for that

#34   — Edited

DJ sorry I am confused a bit the checkbox is checked as shown in the picture above and the current code is. BitConverter.ToUInt16 What are you saying it should be like the following?

 Int16 AngleZ = BitConverter.ToInt16(response, 0);
 Int16 AngleY = BitConverter.ToInt16(response, 2);
 Int16 AngleX = BitConverter.ToInt16(response, 4);

UPDATE: I made the above change and that corrected the var's for the angel values and I found an error in the invoker command string so with both those Items corrected the skill seems to be working.

User-inserted image

DJ I just want to thank you for dealing with all the dumm questions and working with me to make this happen this is a very important part of helping with robot stability in my project.   This skill is provided servo values like a gimbal for every axis. It also provides YPR angle values that can be used for other scripting.

#35   — Edited

NEVER MIND I FOUND THE ISSUE IT DID NOT LIKE 1.0 AS THE RELEASE I HAD TO CHANGE IT TO 1 FOR THINGS TO WORK.

DJ, I am having issue publishing the skill...  Please see below it say the plugin has an error but it looks to me like it meets the requirements.  I don't know where it is picking up this BETA and Version 0 from.

User-inserted image

User-inserted image

#36   — Edited

For those who want to see the completed VS code in the skill here it is I hope it helps anyone looking to make a skill.

using System;
using System.Windows.Forms;
using ARC;
using ARC.Config.Sub;

namespace ESP32_MPU6050 {

  public partial class MainForm : ARC.UCForms.FormPluginMaster {

    Configuration _config;

    readonly string _CMD_GET_VALUES = "GetValues";
    readonly string _CMD_DEBUG_ON = "DebugOn";
    readonly string _CMD_DEBUG_OFF = "DebugOff";

    System.Timers.Timer _timer;
    bool _isClosing = false;

    public MainForm() {

      InitializeComponent();

      // show a config button in the title bar. Set this to false if you do not have a config form.
      ConfigButton = false;

      _timer = new System.Timers.Timer();
      _timer.Interval = 200;
      _timer.Elapsed += _timer_Elapsed;

      _timer.Start();

        }

    public override void SetConfiguration(PluginV1 cf){

        ARC.Scripting.VariableManager.SetVariable("$AngleZ", 0);
        ARC.Scripting.VariableManager.SetVariable("$AngleY", 0);
        ARC.Scripting.VariableManager.SetVariable("$AngleX", 0);
        ARC.Scripting.VariableManager.SetVariable("$servoRvalue", 0);
        ARC.Scripting.VariableManager.SetVariable("$servoPvalue", 0);
        ARC.Scripting.VariableManager.SetVariable("$servoYvalue", 0);

        base.SetConfiguration(cf);
    }

        private void FormMain_FormClosing(object sender, FormClosingEventArgs e){

        _isClosing = true;

        _timer.Stop();
        _timer.Dispose();
        _timer = null;
    }

    private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e){

        if (_isClosing)
            return;

        readValues();
    }

    public override object[] GetSupportedControlCommands()
    {
      return new string[] {
      Common.Quote(_CMD_GET_VALUES),
      Common.Quote(_CMD_DEBUG_ON),
      Common.Quote(_CMD_DEBUG_OFF)
    };
    }

    public override void SendCommand(string windowCommand, params string[] values)
    {

        if (windowCommand.Equals(_CMD_GET_VALUES, StringComparison.InvariantCultureIgnoreCase))
        {
            readValues();
        }
        else if (windowCommand.Equals(_CMD_DEBUG_OFF, StringComparison.InvariantCultureIgnoreCase))
        {
            Invokers.SetChecked(cbDebug, false);
        }
        else if (windowCommand.Equals(_CMD_DEBUG_ON, StringComparison.InvariantCultureIgnoreCase))
        {
            Invokers.SetChecked(cbDebug, true);
        }
        else
        {
            base.SendCommand(windowCommand, values);
        }
    }

    /// 
    /// The user pressed the config button in the title bar. Show the config menu and handle the changes to the config.
    /// 
    public override void ConfigPressed() {

      using (var form = new ConfigForm()) {

        form.SetConfiguration(_config);

        if (form.ShowDialog() != DialogResult.OK)
          return;

        _config = form.GetConfiguration();
      }
    }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void cbDebug_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

    void readValues()
    {
        try
        {

            var response = EZBManager.EZBs[0].SendCommandData(12, 0x00);

            Int16 AngleZ = BitConverter.ToInt16(response, 0);
            Int16 AngleY = BitConverter.ToInt16(response, 2);
            Int16 AngleX = BitConverter.ToInt16(response, 4);
            UInt16 servoRvalue = BitConverter.ToUInt16(response, 6);
            UInt16 servoPvalue = BitConverter.ToUInt16(response, 8);
            UInt16 servoYvalue = BitConverter.ToUInt16(response, 10);

            ARC.Scripting.VariableManager.SetVariable("$AngleZ", AngleZ);
            ARC.Scripting.VariableManager.SetVariable("$AngleY", AngleY);
            ARC.Scripting.VariableManager.SetVariable("$AngleX", AngleX);
            ARC.Scripting.VariableManager.SetVariable("$servoRvalue", servoRvalue);
            ARC.Scripting.VariableManager.SetVariable("$servoPvalue", servoPvalue);
            ARC.Scripting.VariableManager.SetVariable("$servoYvalue", servoYvalue);

            if (Invokers.GetCheckedValue(cbDebug))
                Invokers.SetAppendText(textBox1, true, "AngleZ: {0}, AngleY: {1}, AngelX: {2}, Yaw: {3}, Pitch: {4}, Roll: {5}", AngleZ, AngleY, AngleX, servoYvalue, servoPvalue, servoRvalue);
            }
            catch (Exception ex)
            {
               Invokers.SetAppendText(textBox1, true, ex.ToString());
        }

    }

        private void button1_Click(object sender, EventArgs e)
        {
            readValues();
        }

        private void cbUpdate_CheckedChanged(object sender, EventArgs e)
        {
            if (cbUpdate.Checked)
                _timer.Start();
            else
                _timer.Stop();
        }

    }
}
#37   — Edited

Wow! That whole process was quite impressive! love

Author Avatar
PRO
Canada
Twitter
#39  

Excellent. Really excited about this new skill. Love to see it published.

#40  

@smiller29

do you mind sending the link of the ESP32 you are using. Much appreciated. Thanks