CAN set input pos velFF and torqueFF confusion

I’ve been working to create a ROS library that sends CAN frames through Ethernet to a Teensy 4.1 and CAN to four separate V3.6 odrives running v0.5.1 for a swerve drive I’m developing for fun (I’ll probably post it under projects with some code when it starts working).

I have developed classes that can successfully send and receive CAN frames requesting vbus voltage, errors, etc. but am now trying to send position and velocity control inputs. The documentation states the following:

My question is the following: what is velFF and torqueFF? I have had a look at the source code (Firmware/communication/can/can_simple.cpp):

void CANSimple::set_input_pos_callback(Axis& axis, const can_Message_t& msg) {
    axis.controller_.input_pos_ = can_getSignal<float>(msg, 0, 32, true);
    axis.controller_.input_vel_ = can_getSignal<int16_t>(msg, 32, 16, true, 0.001f, 0);
    axis.controller_.input_torque_ = can_getSignal<int16_t>(msg, 48, 16, true, 0.001f, 0);

void CANSimple::set_input_vel_callback(Axis& axis, const can_Message_t& msg) {
    axis.controller_.input_vel_ = can_getSignal<float>(msg, 0, 32, true);
    axis.controller_.input_torque_ = can_getSignal<float>(msg, 32, 32, true);

I appears that axis.controller_.input_pos_, axis.controller_.input_vel_, axis.controller_.torque_ are being written to equivalent variables from the odrivetool of <odrive>.<axis>.controller.input_pos, <odrive>.<axis>.controller.input_vel and <odrive>.<axis>.controller.input_torque respectively.

This seems reasonable, however in closed loop position control, I don’t understand why velocity and torque are being written, and why they are written in a different format. Surely only the position variable has any effect? Have i interpreted this code incorrectly and it is actually modifying controller settings like velocity limit and torque limit?

yes, set them to zero. The feedforward terms are for advanced users, for example if you happen to know what the static torques on the joints will be from the jacobian, then you can improve the control ferformance by sending them as feedforward - this takes a lot of load off of the position controller and allows it to react faster to actual disturbances


Thanks for the lightning fast reply.

Features like this is the reason why this project continues to astound me with how much thought has gone into it.