-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explanation #6
Comments
It's in the Arduino code based on the encoder counts - basically the lines you pointed out. I put all the details & calcs here: https://github.com/XRobots/ReallyUsefulRobot/blob/main/wheelReduction.txt |
Thanks for the quick response. I have been checking and testing with the calculation you refered to. But it I am doing something wrong which I can not figure out. The robot is going into the same directions in RVIZ but not with same amount. The real robot might go for 5 meters which should correspond to 5 squares in RVIZ but in RVIZ , it is showing so much less than that in RVIZ. I have hoverboard motors which are the wheels by them self. Wheel diameter is 6.5 inches =165.1 mm. And the ROBOT_WIDTH is 480 mm, the cpr is 90. Here is my Arduino code part: /*A node which subscribing /cmd_vel coming from keyboard(teleop node) */ #define ROBOT_WIDTH (480) //MILLI METER /* Turning: 1 radian = 130.829800121/pi=41.644418786 encoder counts HardwareSerial& odrive_serial1 = Serial1; // cmd_vel variables to be received to drive with // timers for the sub-main loop // position and velocity variables read from the ODrive long pos0_old; ros::NodeHandle nh; //function that will be called when receiving command from host
} ros::Subscriber<geometry_msgs::Twist> cmd_vel("cmd_vel", handle_cmd); //create a subscriber to ROS topic for velocity commands (will execute "handle_cmd" function when receiving data) void setup() { nh.initNode(); //init ROS node } //_________________________________________________________________________ void loop() {
} void publishPos() { |
Maybe multiply the number by 5 then? |
Does not seems as a solution for the problem but another question is that : "forward0 = demandx * (173.5184116 * modifier_lin) ; // convert m/s into counts/s". So according to my understading u assume that setVelocity() takes ticks per second because that is what you are sending. While according to "https://docs.odriverobotics.com/ascii-protocol" the velocity is "the desired velocity in [turns/s]" which is different to the ticks/s you sending. Is not turn/s the revolution/s? |
turns/s is in the new ODrive firmware that's just been released. I'm using the old firmware which is counts/s |
Ok, but then that is why I have problems with it. Do you recommend me to use an old firmware or should I change the code to work with turns/s instead? Does the getposition in old firmware returns counts? becuase the new one returns turns which means 1.3 revloution is detected as one revolution and so on. |
Yes it returns counts. It's up to you I guess, I haven't tried using the new firmware yet. |
I have the same Odrive controller, but I am building 6-wheeled robot so I have three of them and I am using an Arduino and Jetson Nano as the brain of the robot. I can not publish Odom from Arduino, so I am sending pos0, pos1 and nh.now() to c++ node running on Jetson and the node on Jetson fix the rest exactly as u do. I get everything working fine but the robot move very fast while it is moving very slow in Rviz and I believe that is because u are using different wheel size and so on. But I can not see where u input ur wheel size and wheel separation and so on. I am wondering if you can point out where u do that and if you can explain quickly what is the values 83466,15091 and 83.44 respectively in lines 112, 115 and 135.
The text was updated successfully, but these errors were encountered: