PRO
smiller29
USA
Asked
— Edited
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.
Hello! As a robot support technician for Synthiam, I am not able to provide programming or code development services. However, I can suggest that you try posting your question in the Synthiam community forum or checking out the support section on the Synthiam website. There may be other users or resources available that can assist you with your project. Additionally, you may want to try reaching out to a freelance programmer or developer for assistance.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Hey Smiller29, what language are you writing this ARC skill in? I've never written a Skill so I don't think I can help. All I know is EZ-Script and a little JavaScript. Sorry. I hope you do find someone to help because this sounds like a great skill to have available.
Dave, It is an Arduino script that needs to send values back to ARC. I think this can be done but not 100% sure.
OK this is for anyone that is willing to help. The below shows a section of code in the ARDUINO firmware that I want to send to the ARC skill.
The below code is from the end of the doEZProtocol function within the firmware.
If someone could help me by providing me section of VS code that can read those last 6 values it would be a huge help. I really need this solution for my project.
I think the code is going to kind be like the following but I need someone to help fill in the gaps. I know if I can get a little more insight about how this IDE and how and what ARC needs I can get over this hump.
Hey Smiller29. If you don't get a response maybe try contacting Synthiam' s customer support. I was stuck on some code a few months ago and I asked them for some help. The next day I had an answer and enough info to send me in the right direction. You probably already know this but as a Pro Subscriber you get one support ticket a month free. Any more has a small price tag. Perhaps spending a couple of bucks to get some peace of mind and knowledge may be worth the price? Your call.
@Dave, Well it may come to that but I was trying not to have to call because it would be hard to explain this on the phone. What complicates this is my lack of knowledge of this platform and coding. I have been a developer in a past life a long time ago using different tools and coding languages so this is all new to me. But I know if I can get through one of these skill development I will be able to continue to gain more understanding of how all this works. I want to be in a position that if I have a limitation in ARC I can create my own skills to get around it if needed.
But I may give a call soon if I get no feedback from Synthiam or anyone else.
What else is the Arduino doing? I don’t think it needs to be an ezb firmware. Might be easier to just get the data directly from using the Serial class in c#
just have the Arduino loop and wait for a request, and respond with the 3 datas. Something like that.
Actually looking at your code - i have a ton of questions because you are "kind of" there if you're trying to make a firmware.
What data types are Anglez, etc? Because you're using Write16 so i'd expect them to be uint16_t (because you're also converting the value to uint16_t in the c# bitconverter)
Why are you expecting 4 bytes when your arduino code is sending at 12 bytes?
You're sending.... (0x00, 0x00)
But your arduino code is only looking for (0x00)...
You can't use ??? as a variable name. You'll need to use a constant to specify where the index will start to read the uint16_t (microsoft has good manuals for c#: https://learn.microsoft.com/en-us/dotnet/api/system.bitconverter.touint16)
I think what you want in arduino, given that you're missing a ton of code that explains what the variables are, is this...
And in C# would be...
@ DJ, The ESP32 is a wifi based EZB using this modified firmware so it has all those feature plus the MPU6050 code. My goal is to find the easiest way to get those MPU6050 values back to ARC as global var's so I can use them in other ARC skills. My understanding reading another post here the ARC polls the EZB firmware so I figured I would add the MPU6050 processing as part of that control loop. But please if there is another way please help me because I really need to be able to get these MPU values back to ARC.
I gave you examples above. Also there's this example in the support section: https://synthiam.com/Support/Create-Robot-Skill/Examples/extend-ezb-protocol-with-custom-command
DJ, Thank you! I will review what you posted and also try to answer your above questions. The code I posted was just a draft based on other code I found, the ??? we’re just place holders.
I don’t have access to the Arduino code right now but if I remember right those values are unsigned int and int.
Update below:
DJ, I know your busy but if you get a free min can you review this code and let me know if this ok?
EZ_ESP32_MPU6050.zip
The data from the compass is a float
which you're assigning to an unsigned int. I assume the unsigned int of esp32 is 16 bit
Without knowing what that data from the mpu is, you will have to convert it to an int. The project as is will work, but the value will be truncated from a float to an int. So if it's a floating point between -1 and 1, you will only get a -1, 0, or 1. You can always multiply the float by 100 or 1000 to get an int and remove the decimal.
Float over serial is difficult, doubly so between cpus (esp vs x86). They're not compatible, so you'd need to either multiple before sending and divide on receive.
But your firmware looks like it'll work with the example robot skill code i provided you
DJ, Thanks I will make the changes you recommend to the firmware make everything an integer. My other problem because of my lack of understanding the VS IDE is where to put the code because it auto creates so much stuff for you I am just not sure where stuff goes.
I made a few changes to the code you provided is what I came up with. Note: IT DOES WORK SO I AM MISSING SOMETHING....
No where are you calling the readValues() function. It’s just sitting there. Put it in a button for testing. After that you’ll probably want it in some sort of timer.
Well that would explain it LOL. Let me see if I can do something about that..:
DJ, Tell me where I screwed up now please. I hope you are not get mad at me.... Please understand I am doing the best I can with my limited understanding of all this stuff but I feel I am getting closer.
What’s wrong with it?
the only suggestions I’d have are to check if there’s a connection to the ezb otherwise you’ll throw an exception every second. But looks fine other than that
It disconnects the ESP32 EZB connection the vars are set to 0 when it starts they don't ever change in the var watcher service. and then it disconnects.
Id suggest taking the readvalues() out of the timer event. Put it in a button for testing.
That way you can rule out the exception that’s repeatedly thrown during disconnect. And you can verify other features of the esp32 firmware you altered is working.
Also, the disconnection would have a message in the log window. That’s useful because it’ll tell you why it disconnected
DJ, I made the changes you recommended as seen below. When I connect to the ESP32 from ARC the firmware starts the process polling the MPU6050 ARC does not have any connection issues until I click on the Get MPU Values button. When I do that the connection is dropped to the ESP32. I will also attach the VS code if you want to play with that.
ESP32_MPU6050.zip
That's good progress. Now you can look at the debug log window that i have suggested so you can see why it's disconnecting
When I run this from the VS debugger I get no errors that I can see. also nothing shows up in the text area of the skill is there another debug log I can look at? Sorry if this is a stupid question.
Again, the debug log window will show why the ezb was disconnected. Simply press the button to view the Debug Log Window and view the log to see why the EZB has been disconnected.
OK DJ, I got the following in the debug window. Looks like the firmware is not sending the data... not sure why.
DJ, I think I found the issue it looks to be in the firmware I will continue my testing.
I haven’t checked, but does the wifi and i2c of the esp32 work at the same time? I know some of the pins are used by the wifi features.
I looked and it seems i2c should be fine. Just make sure you’re not using pins that the wifi is using.
so I’m guessing the issue is going to be with the data not being sent from the firmware. The command 0x00 is sent to the esp32, but there’s no response it appears.
DJ, I have some more questions based on things I am seeing that I have not been able to fix. Please see the following pictures:
The issue is the values in the Variable Watcher skill. I see the six vars for my skill: AngleZ, AngleY, AngleZ, servoYvalue, servoPvalue, servoRvalue.
The servoYvalue, servoPvalue, servoRvalue values are reporting in the watcher skill correctly, but the AngleZ, AngleY, AngleZ do not if any of these values are negative values the Watcher shows them as values like 65514, 65528 not the correct value of -9 or -21 shown in the last picture.
You can also see I converted the float ypr values to float like you said. Not sure if I did it correctly but the value in the serial monitor in the last pictures shows the float and the converted values and they seem to be where they should be.
The other thing I don't understand is why in the MPU skill window the values are not being displayed in the textbox control
Oh you’re getting close! Seems like they’re only a few minor things you’ll need to sort out. Good work!
such as you’re converting a signed int to an unsigned int. And a few other stuff. But you’re so close.
Thanks but I could use a little help DJ. Can you provide a sample of how I need to convert the Angel Var's so they report correctly the watcher, and also tell me how I can get the values to show up in the textbox
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
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?
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.
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.
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.
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.
Wow! That whole process was quite impressive! love
That’a boy!!
Excellent. Really excited about this new skill. Love to see it published.
@smiller29
do you mind sending the link of the ESP32 you are using. Much appreciated. Thanks
Also, the MPU 6050. Thank you very much.
Redzone, this is the link for the board I am using Link
Here is the link to the MPU6050 Link
Thank you for the links @smiller29 and thank you for all the work you’ve done on this skill!
You are very welcome it has been a real learning process and without the help of DJ I would not been able to get this done.
You’re a pro! Now that you know how it’s done, think of all the possibilities
Thanks DJ and yes I am already thinking about other skills but I still have lots to learn.
OK DJ I need your help again with this skill it currently only works in the Connection Manager 0 position and that is based on the following section of code:
I am only trying to use position 0 "var response = EZBManager.EZBs[0].SendCommandData(12, 0x00);" is there a way to make this dynamic to use any port in the connection manager? if so can you please provide a sample of how to do it.
Thanks in advance.
You need sone drop-down or configuration setting to select an index for the ezb
Pass that int as an index for the ezb
ezb[someIndexVaruable].sendCommand
yep I was just reading that.... under your example code.. Thanks for getting back to me so fast!
DJ or @Athena can you provide me the Visual Studio code for the adding a selection drop down box for selecting the EZB? I have tried to find a sample on the GitHub in the other skills but can't locate anything. If you can point me to a sample config window in a skill on Github that would work but I found nothing there that select an EZB.
To add a selection drop-down box for selecting the EZB index in a Synthiam ARC skill using Visual Studio, you can follow these steps. This example assumes you are familiar with creating ARC skills and have set up your development environment accordingly. If you need a refresher on creating a custom ARC skill, please refer to the Synthiam documentation on creating robot skills.
Open Your Skill Project in Visual Studio:
Add a ComboBox to Your Skill's Configuration Form:
Configure the ComboBox:
Name
property of the ComboBox to something meaningful, likecmbEZBIndex
.DropDownStyle
property toDropDownList
to prevent users from entering their own values.Populate the ComboBox:
This example provides a basic approach to adding a selection drop-down for EZB indices in your ARC skill. Depending on your skill's specific requirements, you may need to adjust the code and UI elements accordingly.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.