Hey Guys,
I recently picked up a VESC 6+ and I can see that it has a built in IMU. I have managed to write my own code to access and use all the commands built into the VESC i.e. SetDuty, GetVals... etc...
However I have not managed to find any info on extracting the IMU Data. I would assume this to be straightforward as the VESC tool can do this over USB, however documentation is slim. Does anyone have any pointers to get me started? I am writing in python due to its ease for rapid prototyping.
I would like to be able to read in the IMU on my Raspberry PI over UART.
Thanks in advance for the help,
Stefan
Stefan , I have the same problem but over CAN , seems that some parameters are not still available on all protocols. Hope someone can point us . Flavio
The position in space is shown in the mobile VESC-Tool, via BLE connection, via UART. Scroll to RT-Data, scroll all the way down.
I'm sure Benjamin can point you to the code that is usable for you.
Did you try "COMM_SET_CHUCK_DATA" ? This you return you something as per given in this function: (in commands.cpp)
void Commands::setChukData(chuck_data &data)
{
VByteArray vb;
vb.vbAppendInt8(COMM_SET_CHUCK_DATA);
vb.vbAppendUint8(data.js_x);
vb.vbAppendUint8(data.js_y);
vb.vbAppendUint8(data.bt_c);
vb.vbAppendUint8(data.bt_z);
vb.vbAppendInt16(data.acc_x);
vb.vbAppendInt16(data.acc_y);
vb.vbAppendInt16(data.acc_z);
emitData(vb);
}
Thanks for the advice, and no I have not. I did not realise that CHUCK would have a correlation with the IMU. Also are you suggesting that a set command will in fact return the current IMU data? I see that there is also a command called COMM_GET_DECODED_CHUCK, however I am a little hesitant to use it as I did try COMM_GET_DECODED_PPM and fried the software, requiring a reflash of the whole VESC... thoughts?
Also thanks Frank! I will see if I can run a search on the git for the tools! Maybe there will be something that comes up while we wait for Benjamin's reply!
Actually whilst looking through the VESC_TOOL code (datatypes.h), I stumbled across the ENUM list shown below. It is an extended version of an ENUM list found in datatypes.h in the UART code repository. I would assume that this would mean that sending the VESC a command with ID65 would send COMM_GET_IMU_DATA and thus one could read the serial port and obtain it. Would be nice to get some clarification on this before I end up frying the software for the VESC again.
Yes, it needs clarification. To me, the COMM_SET_CHUCK code seem to refer to a read (=GET) of the IMU data through CAN bus (or UART ?). I would give it a try.
The datatypes.h code in VESC_tool also has a "COMM_GET_IMU_DATA", which might be usable. I couldn't find code using it (but possibly I don't have the same vesc_tool version as you have).
Otherwise, you may want to use a portmon (COM port spy) on the PC using VESC_tools to see the outgoing and incoming UART frames to check..