Closed waythe closed 2 years ago
And do I need to modify mainboard-hack.uvoptx
& mainboard-hack.uvprojx
if I am trying to add a variable for my own.
Now I added a new variable similar with the VARIANT_USART and registered it in platformio.ini, build has no problem but not sure whether it can work yet.
Hi,
The firmware has a lot of possible conbinations, so not all can be documented. As mentioned in the wiki:
speedBlend is also defined whenever electric_brake is defined. So this could work for all variants except Transpotter if you know what it does and what you want.
Best way to understand how it works is to try it.
hi I was trying different modes and settings today. I am still using USART variable with my arduino. After tried one or twice, now I met a strange thing that the motors stops moving, it does not respond the input. what I see from the Arduino debug message I am sending proper commands with nonzero speed + steer. the board don't beep so I think they can receive the Serial Commands properly. I use Bluetooth module to debug, the board output like: IN2_RAW: value:300 init:0 min:-1000 max:1000 so it means commands are received.
but it is strange that the motors don't move. the driver should be ok, when I use SPD mode, the wheels are trying to keep standstill. any suggestion to debug?
I am now trying to fetch the latest firmware so that I can compare it with my local code, in case I made some low level mistake in my code.
one thing I can think of is that I connect the two boards' power buttons together. and when flushing the firmware, I need to hold the power button, does it influence the other one?
I changed the FLASH_WRITE_KEY then they are back now. I guess it's the Input Calibration's bad. but I thought Input Calibration is for ADC, they also take effect for Serial input?
BTW, are you convenient to update the unit of input in wiki? I was using -100~100 in VLT mode, when I change to TOR/SPD, the motors move much faster. I guess in SPD mode the unit becomes RPM? but what is the unit in VLT/TOR?
seen from https://github.com/EFeru/hoverboard-firmware-hack-FOC/issues/204 which proves that for SPD mode the input is RPM. still have no idea of the unit in VLT/TOR.
and from my test, in SPD mode, the motors run faster when backward when I gave the same input (like -15 is obviously faster than 15). this looks strange. where I can change the behavior? ( I changed STEER_COEFFICIENT to the same with SPEED_COEFFICIENT but I guess it is not the cause.)
also, I tried that STANDSTILL_HOLD, this does not work as I expected. in UASRT, the input1 & input2 are steer & speed. I expect that if I give input like "steer = 100 and speed = 0", the car will turn around in place. and if I give input like "steer = 0 && speed = 0", the car will stand still. I'll see if I am able to modify the logic by myself.
hi, now everything works. (I met several other troubles like connectivity problem and failure of Arduino board so it takes extra time) finally, I kept the VLT Mode (with STANDSTILL) for my transpotter after trying other modes. Here are some experiences or questions:
Hi,
There is no unit for the input in Voltage or Torque, meaning the physical motor operation 0 to maximum is mapped to 0, 1000. Basically, we just request maximum phase pwm and the torque is the result.
If you want to obtain torque in Nm then you need to measure it with a torque sensor and create a map/look up table which you place before the input, i.e., Torque request -> torque map -> input request [-1000, 1000]
oh Thank you all @Candas1 @EFeru , I understand the unit of Voltage / Torque doesn't mean that much. the difficulty I met was hard to decide a proper value as the inputs (of cause tests will give the most intuitive feeling, but in my case, I don't have a wide & safe enough space to test the device, especially when I want to test the behavior with load and higher input value.) and when I change the mode with the same Arduino code, the output differs a lot (like from VLT to SPD). SPD is easy to understand with unit RPM. I guess some notes or suggestions can be given in the wiki so as to help starters to choose parameters.
the physical motor operation 0 to maximum is mapped to 0, 1000. is '1000' a fixed number or editable? or it is also influenced by N_MOT_MAX, INPUT FORMAT, FIELD_WEAK_HI, etc?
@Candas1
Hi I guess the STANDSTILL_HOLD: Give wheels a torque if the input is zero and speed is almost zero. the ELECTRIC_BRAKE: Give a reverse direction torque if the input is zero and speed is slow. So what does STANDSTILL_HOLD mean if ELECTRIC_BRAKE is enabled? also, do they work for all variables (except VARIANT_TRANSPOTTER which is special)? I didn't see the answer in the wiki.
I looked into the code a little. for standstillHold() & electricBrake(), they read the
input1[inIdex].cmd and input2[inIdx].cmd
, I think in different variables the inputs mean different, in USART they aresteer & speed
(instead of brake/throttle). so if they judge according to Serial input, do they act correctly?also I notice that electricBrake() needs a parameter speedBlend, which seems defined only in VARIANT_HOVERCAR and VARIANT_SKATEBOARD. so are they defined for certain variables only? how to choose whether to use STANDSTILL_HOLD or ELECTRIC_BRAKE?