Example: Move Servos
If you wish to move a servo, it can be done one of two ways. You can specify the servo to move directly, or take advantage of ARC built in servo helpers.
The servo helpers are what you find throughout the ARC interface, when prompting users to select a servo in configuration screens. The user can always select one or more servos that have a relationship to each other, including inverting. It also allows the user to specify a MIN and MAX for each servo.
The servo Helper in ARC makes moving servos a breeze - and that will make your plugin interact with servos much easier, without having to perform all the relationship math and limits yourself.
Servo Movements (Raw) To move a servo with raw commands, not using the servo helper, here is path to the class:
ARC.EZBManager.EZBs[0].Servo
It is non recommended to set servo positions using this method, unless they are non user-configurable servos. If your plugin expects users to configure the servos, use the UCServoSelection object and the helper methods below.
Servo Movements (UCServoSelection) The ARC UI has the ability for users to specify multiple servos and have the positions relative to each other with invert options, etc This can be viewed in the sourcecode for the Click servo plugin here: https://synthiam.com/Software/Manual/16147
You can install that plugin to see how it works, and watch the video on how to set it up. The example in that source code demonstrates how to use the UCServoSelection user control for users to specify multiple servos, if you choose to go this route. You will notice that the array collection of servos is passed to helper commands in the ARC.EZBManager directly.
By using the UCServoSelection and ARC.EZBManager helper methods, the servo configuration can be easily stored in the project file and passed to helper methods for executing. For example, to extract and store the user's servo configuration from a UCServoSelection into the project file can be like so...
_cf.SERVOS.AddOrUpdate(ConfigurationDictionary._HORIZONTAL_SERVOS, ucServoSelectionX.Config);
_cf.SERVOS.AddOrUpdate(ConfigurationDictionary._VERTICAL_SERVOS, ucServoSelectionY.Config);
Now to move the servos from the configuration _cf.SERVOS file, simply do the following...
ARC.EZBManager.SetServoIncrement(_cf.SERVOS[ConfigurationDictionary._HORIZONTAL_SERVOS], -1);
ARC.EZBManager.SetServoIncrement(_cf.SERVOS[ConfigurationDictionary._VERTICAL_SERVOS], 1);
When the popup says it doesn’t detect visual studio, you can still skip and continue. I wonder why it’s not detecting it? We had a hard time trying to find a proper way of detecting - even Microsoft’s suggestion didn’t actually work eye roll
ill look into it a bit further and see if we can find a better way of detecting
@DJ: It's easy to find the Visual Studio 2017 and up: Microsoft: https://github.com/Microsoft/vswhere/wiki/Find-MSBuild
Some quick c# code to use with .NET: https://github.com/ppedro74/Utils/blob/master/FindVisualStudio/Program.cs
We went this route and it didn’t work on my computer - because I had a preview of visual studio installed which isn’t in that directory path. Microsoft had numerous suggestions of detecting visual studio. The one which worked for our various installations was a registry check.
apparently with the above individual, the registry didn’t work either. I’ll have to combine a few methods.
everything looks simple from the outside - until you have a hundred thousand+ installations of your software. That’s when you run into things like this lol
@DJ: I agree sometimes the things go out of script easily.
I avoid going through the registry keys, unless is recommended by the vendor. A lot of people blame the changes (keys, entries are renamed etc), but, that is normal if I own my product is my business and is part of the software evolution. Some products you can break the support contract agreement if you query directly the database, or if you look elsewhere outside of the public API.
Is true story some years ago a "rogue" developer on my team released a Sharepoint integration using a mix of APIs and database queries, everything worked well with multiple clients, until one day the Microsoft Black suits visit one of the customers to follow up on an unrelated support ticket, and they basically used "unsupported" card and left the client hanging, and we had problems too, unfortunately the Rogue developer went to another galaxy ... and the team suffered the consequences.
That does not mean I'm not tempted to do it...
I used the vswhere before and I would say is almost 99% bulletproof, is used with Xamarin, NVIDIA, Intel setups. If you add vswhere.exe to your project (nuget package) you cover scenarios where the tool is not present or have been deleted (broken uninstalls).
The other fallback could be ask the user the visual studio version.
The other reason to avoid registry is due to Visual Studio uses a private exclusive registry keys to store more stuff: http://www.visualstudioextensibility.com/2017/07/15/about-the-new-privateregistry-bin-file-of-visual-studio-2017/
So the things are getting more complex.
The above post is only part of the "Full solution" for example I have one setup with visual studio 2017 c# installed and Visual studio 2019 with Python and C++, vswhere will return 2019 version, but my c# is done with VS2017.
If you are generating customized vs version project files, maybe a fallback (ask the VS version) will cover more bases.
Yes - Microsoft has a few pages on how to identify visual studio and we tried them all during testing - the one we went with was with registry. I'm going to combine the two as using only one method apparently doesn't work for all cases.