Cannot control variable speed odrive motor with arduino code

Hi everyone i am using odrive motor to control my robot in velocity control mode by publishing the velocity from workstation to robot computer but the problem i am sending different velocities but motor is always is same speed which i defined odrive interface odrv0.axis0.controller.config.vel_limit=40 turn/s.Here is my arduino code and workstation publish velocity interface?Can you help me,please?

Libraries and Variables*********************
//ODrive
#include <ODriveArduino.h>

//ODrive Objects
ODriveArduino odrive1(Serial1);

//ROS
#include “ros.h”
#include “geometry_msgs/Twist.h”
#include <ros/time.h>
#include <tf/tf.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>
#include <geometry_msgs/Vector3.h>

ros::NodeHandle nh;
geometry_msgs::TransformStamped t;
nav_msgs::Odometry odom_msg;
ros::Publisher odom_pub(“odom”, &odom_msg);
tf::TransformBroadcaster broadcaster;

// cmd_vel variables to be received to drive with
float demandx;
float demandz;

// timers for the sub-main loop
unsigned long currentMillis;
long previousMillis = 0; // set up timers
float loopTime = 10;

// ODrive init stuff
int requested_state;

// output variables to drive the ODrive
int forward0;
int forward1;
int turn0;
int turn1;

// position and velocity variables read from the ODrive
int vel0;
int vel1;
long pos0;
long pos1;

void velCallback( const geometry_msgs::Twist& vel)
{
demandx = vel.linear.x;
demandz = vel.angular.z;
}

ros::Subscriber<geometry_msgs::Twist> sub(“cmd_vel” , velCallback);

// ********************************* Setup ************************************************

void setup() {

nh.getHardware()->setBaud(115200); // set baud rate to 115200
nh.initNode(); // init ROS
nh.subscribe(sub); // subscribe to cmd_vel
nh.advertise(odom_pub);
broadcaster.init(nh); // set up broadcaster
Serial.begin(115200); // ROS
Serial1.begin(115200); // ODrive
delay(4000);
OdriveInit1();
// **********************************Main loop ************************************

void loop() {

nh.spinOnce(); // make sure we listen for ROS messages and activate the callback if there is one

currentMillis = millis();
if (currentMillis - previousMillis >= loopTime) { // run a loop every 10ms
previousMillis = currentMillis; // reset the clock to time it
forward0 = demandx * 326041; // convert m/s into counts/s
forward1 = demandx * 326041; // convert m/s into counts/s

        turn0 = demandz * 353279;        // convert rads/s into counts/s
        turn1 = demandz * 353279 ;      // convert rads/s into counts/s
        
        forward1 = forward1*-1;          // one motor and encoder is mounted facing the other way

        odrive1.SetVelocity(0, forward0 + turn0); 
        odrive1.SetVelocity(1, forward1 + turn1);

  } // end of 10ms loop

} // end of main loop

Hi Adem,

It looks like you have a units problem - you are using SetVelocity() with counts/s, but the ODrive firmware expects turns/s. Use turns/s with SetVelocity().

How did you manage to fix this?