You are here

Servo issue after fmw update

4 posts / 0 new
Last post
Jendrik
Offline
Last seen: 5 years 7 months ago
Joined: 2017-12-27 13:22
Posts: 2
Servo issue after fmw update

Hello everyone,

I am fairly new to the VESC world and am currently trying to rebuild a modified version of the MIT racecar.
For the project the servo output is used. Since I had a VESC with a missing bootloader, I had to use the VESC Tool to repair it and updated as well the firmware to the servoout.bin one.
The servo is now working as well, meaning it goes to the 0 position when booting the VESC. However, it seems that there was a change in the USB communication protocol from fmw 2 to fmw 3. Steering the motor is no issue, but steering the servo is not possible. 

From looking through the vesc tool code, it seems that the option to control the speed of the servo was added. I assume, that I have to add the respective value to the serial command.
Is there the possibility to just set it to the maximum value?

What is done in the MIT code looks like this:   

VescPacketSetServoPos::VescPacketSetServoPos(double servo_pos) :
  VescPacket("SetServoPos", 3, COMM_SET_SERVO_POS)
{
  /** @todo range check pos */

  int16_t v = static_cast<int16_t>(servo_pos * 1000.0);

  *(payload_.first + 1) = static_cast<uint8_t>((static_cast<uint16_t>(v) >> 8) & 0xFF);
  *(payload_.first + 2) = static_cast<uint8_t>(static_cast<uint16_t>(v) & 0xFF);

  VescFrame::CRC crc_calc;
  crc_calc.process_bytes(&(*payload_.first), boost::distance(payload_));
  uint16_t crc = crc_calc.checksum();
  *(frame_->end() - 3) = static_cast<uint8_t>(crc >> 8);
  *(frame_->end() - 2) = static_cast<uint8_t>(crc & 0xFF);
}

With 3 being the length of the package (including the COMM command).
Do I just have to set it to 5 now and add max(int16) for the turning speed?
Input is highly appreciated :)

Thank you very much in advance and I hope you all had a nice Christmas time,

Jendrik

Jendrik
Offline
Last seen: 5 years 7 months ago
Joined: 2017-12-27 13:22
Posts: 2

Okay I solved it on my own now.
The MIT repo has simply an outdated datatypes.h and in the new one the command byte for the servo command is different.
Will raise that as an issue in their repo.

Cheers,

Jendrik

subodh.malgonde
Offline
Last seen: 5 years 6 months ago
Joined: 2018-09-18 07:28
Posts: 8

@Jendrik seems to have fixed the issue here (Minor) datatypes.h changed with new VESC hardware. Also this PR may help https://github.com/mit-racecar/vesc/pull/13.

saiteja
Offline
Last seen: 3 years 11 months ago
Joined: 2020-05-08 23:35
Posts: 1

Hello

I am trying to update my firmware using VESC tool version 2.06. I am unable to find the servoout.bin file when did the autoconnect with the tool. Can someone help me how to obtain the servoout.bin file. Or should I upgrade the VESC tool to any latest version??

A.N.V.Sai Teja