what is the ESC signal to control the motor?
Does anyone know what is the ESC input signal which can control the RPM of the Motor? is it the 50Hz PWM(1000us, this corresponds to minimum throttle-2000us, this corresponds to maximum throttle) signal as shown below?
or it is the oneShot or Dshot Signal as shown in herepx4-esc
Also, does anyone know how to log ESC signal? I tried to use "logger on" and "logger off" command to log all the UORB topics, and do you know whether the following two topics includes the ESC signals?
Any comments and suggestions are welcome!
Are you asking about ModalAI ESC? You can find information at https://docs.modalai.com/modal-escs/ and https://docs.modalai.com/modal-esc-v2-manual/. Please see information about V2 (V1 is obsolete). To answer your question about communication, the ModalAI ESC accepts control input via UART. The interface is implemented in PX4, you can find more information here https://docs.modalai.com/modal-esc-px4-user-guide/ and https://github.com/modalai/px4-firmware/tree/modalai-1.12-dev/src/drivers/uart_esc/modalai_esc.
Actuator Controls should be available to log via PX4 which would the the commanded RPM sent out the motors.
What Drone platform are you using and can you confirm that you have the ModalAi ESC V2?
Please review the documentation and let us know if you have other questions.
Thank you for your reply and it's very helpful.
The platform that I am using is the ModalAI M500, and the ESCs attached in this drone are HolyBro BLHeli 20A ESC For S500 V2.ESC.
The following is my questions:
Q1: Do you have a datasheet for HolyBro BLHeli 20A ESC? I want to know is this a one-way or two-way ESC? and what kind of control signal need to send to this ESC?
Q2:I have used an oscilloscope to find out what is the control signal of ESC. According to my experiments(plots are attached), it seems the control signal is PWM signal(The period is 1.8 us and the pulse width ranges between 0.6us for zero power and 1.2 us for the full power)? is this correct?
zero-power pulse width:
full-power pulse width:
Q3:I have collected acturator_control and acturator_outputs. For acturator_control, do you know what's the difference between control and control? As you said, the data in acturator_control is the commanded RPM, But the values of those data seems pretty small which doesn't make sense since those data are collected when quadcopter is hovering.
Hi @DarkKnightCH ,
Nice o-scope, I have the same
a] The ESC is one way, and can be setup via PX4 to use PWM or DSHot. We started shipping with DShot to avoid ESC PWM calibration needs. We don't offer a datasheet for that, but get it from Holybro. There's various docs online.
b] if you are using PWM, the signal is bound to 0-2000us pulse width modulated signals out with our default params. When you power the vehicle on, if an airframe type is selected, you'll get a 900us signal that just lets the ESCs know theres a signal, but it won't spin motors.
There's a bunch of params that can be adjusted: https://docs.px4.io/v1.12/en/advanced_config/parameter_reference.html#pwm-outputs
PWM_MIN of 1060 means, when armed, there will be a 1060us "wide" signal. If you set thrust to max, you'd get a 2000us wide signal, specified by PWM_MAX.
c] these are the 8 channels, 0-7, values of -1.0 to 1.0 ya? This is basically the 'percentage' of full scale from what I gather. So 1.0 would be 2000us, 0 would be 0, if I'm not mistaken.
It seems like Dshot is used if signals around 1us are observed. Regular PWM would have been 1000-2000us range!
@modaltb hey, thanks for the reply and it's really helpful!
For c), Yes. the data that I have collected is bounded by [-1,1]. if 1 is full power, 0 is zero power, what does the value between [-1,0) means? rotate in an opposite direction, but each motor is not suppose to rotate in two-ways, right?
Do you know what does the component of 'acturator_outputs' means?
Negative command typically does mean the command in opposite direction. negative actuator_controls simply means the control is in the opposite direction.
actuator_controls is an array of 4 normalized (to -1..1) values (pitch,roll,yaw,thrust). actuator_outputs are outputs that are coming from the mixer. The mixer converts pitch,rol,yaw,thrust to four motor commands. The units of the motor commands are dependent on where they are sent to (PWM driver or whatever).
You can see some more info here : https://discuss.px4.io/t/how-mixer-work/3886/5
Also, motor direction can be sometimes controlled in software (as well as switching motor wiring). It depends on implementation of the ESC. Sometimes it is easier to wire all motors to ESCs the same way (without switching wires) and then use the direction in software in order to control the spin direction.
Thanks for you help and it is very helpful. As you said, actuator_controls is an array of 4 normalized (to -1..1) values (pitch,roll,yaw,thrust). actuator_outputs are outputs that are coming from the mixer. The mixer converts pitch,rol,yaw,thrust to four motor commands. I assume the ModalAI mixer file is the your own defined mixer file instead of the default mixer file? if yes, where can I find such mixer file?
Observing my current acturator_outputs data , the value of output-output seems reach 1000 when quadcopter is hovering, and according to my oscilloscope observation, the ESC signal value should be between [0.6-1.2] us. Therefore, I guess the control structure is as follows:
High-lever Controllers ------(commanded roll, pitch,yaw, thrust, which are represented by acturator_controls)---> Mixer -----(scaled ESC signal for each motor, which are represented by acturator_outputs)----> Scaler -----(Scale the acturator_outputs into Dshot ESC signal)---->ESCs and Motors.
But right now how can I find such scaler? or How can I find the mapping between acturator_outputs and Dshot ESC signal? I believe the mixer file should have a definition of such mapping.
For standard motors using DShot, I believe a standard mixer is used. Perhaps this page will be useful : https://docs.px4.io/v1.12/en/concept/mixing.html#mixer-loading . You should be able to use a debug console to check which mixer is being used? Maybe @modaltb knows?
mixercommands from the command line you can invoke, I believe it will spit out the file being used.
It also shows on bootup, but that can't be caught unless you are connected to the debug UART on J2.
That said, I know very little about mixers myself! So likely not a help here beyond locating files.