UC4H: Configuring the ESC’s
Amazing! I did not melt my ESCs into slag and they all work. Yippie!
One of the nice things about a UAVCAN ESC is it doesn’t need to be calibrated like a standard PWM ESC. But you do need to configure the ESCs, each with a unique node ID, and set them up so they are in the right position on your frame.
To set the node ID we go into the UAVCAN GUI, click on the automatic Node ID server, and let it assign a random ID so we can see the node. Then we simply open each ESC node, click on “fetch all,” and then change the node ID to whatever we want. Each node can have any ID up to 126. I am setting mine so they are 60, 61, 62, and 63 but it could be 34, 68, 92 and 101. You can choose any ID as long as each node has a unique number and it is not greater than 126. Be sure to click “save all” afterward to change the ID for each ESC.
There is an index to identify the ESCs. I have four ESCs so the count starts at 0 then 1, 2, 3, unlike the Ardupilot count that starts at 1. Each ESC needs to be associated with it’s Arducopter arm/motor number. Don’t be confused with Arducopters motor test which starts at the upper right and goes one motor at a time clockwise labelling each motor in turn A, B,C and D.
For Arducopter, my X frame (picture on the right), motor order is upper-right motor 1 then, going clockwise around the quad, lower-right is motor 4, lower-left motor is 2, and upper-left motor is 3.
We need to associate each ESC, where we have placed it on the quad with the correct ESC Index number for that arm/motor number. But when they first start up the ESC index could point to any arm. It is the digital equivalent of plugging your PWM ESC into the motor outputs on Pixhawk matching the Ardupilot diagram for your frame.
So first you need to attach a motor (without props, right?) to test each ESC separately.
Now we open up the UAVCAN GUI and click on Panels, in the upper menu, then “ESC Panel.”
The ESC panel shows four sliders, the left-most one associated with index 0, the next one to the right index 1, then index 2, and finally index 3. Move the sliders slowly up then back to zero one at a time. One of the sliders will start the motor you have attached running. Note which slider starts the motor running and note the arm you have it on at the moment. Say you have your test motor on arm 4, the lower right. But when you push the sliders up one at a time the motor starts running when you slide up the first slider which is ESC index 0. So you now know that the motor on arm 4 is actually set for ESC Index 0 now and we need to change it to ESC_Index 3, since the ESC index starts at 0. So ESC_index 3 is the lower right motor.
So open up the nodes for each ESC, one at a time, and click on “fetch all” and look at the parameter OUTA1 Index and find the ESC which has OUTA1 Index set to integer 0 and change it to 3 and click “save all.” Let’s say it was the ESC node ID=63. Verify that now when you move slider 3, the right-most slider, the motor starts running.
Note that down on a piece of paper that arm 4, ESC node ID 63 is ESC_index 3.
Now move the motor to another arm and do the same thing until you set the ESC_Indexes so the motor on arm 1 is ESC Index 0, motor on arm 4 is ESC Index 3, the motor on arm 2 is ESC Index 1 and lastly the motor on arm 3 is ESC Index 2. WOW that is confusing. I really don’t understand any logical reason the arm/motors were numbered that way but they are so… It will all be different if you have a hex or an octo. Just follow the Ardupilot diagram for your frame and remember the ESC index will be one less that the Ardupilot arm number in each case.
Note: If you jump ahead and try doing an Ardupilot motor test it will not work. Next we have to “turn on” the UAVCAN ESC’s in Mission Planner.
Or you can do this all automagically by running a slick script OlliW wrote in Python to do all this for you.