Skip to content

Commit

Permalink
Variables x & z are now used as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinbert authored Nov 8, 2023
1 parent df90edb commit a77a49c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ros_diffdrive_robot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ void onTwist(const geometry_msgs::Twist &msg)

// Calculate the intensity of left and right wheels. Simple version.
// Taken from https://hackernoon.com/unicycle-to-differential-drive-courseras-control-of-mobile-robots-with-ros-and-rosbots-part-2-6d27d15f2010#1e59
float l = (msg.linear.x - msg.angular.z) / 2;
float r = (msg.linear.x + msg.angular.z) / 2;
float l = (x - z) / 2;
float r = (x + z) / 2;

// Then map those values to PWM intensities. PWMRANGE = full speed, while PWM_MIN = the minimal amount of power at which the motors begin moving.
uint16_t lPwm = mapPwm(fabs(l), PWM_MIN, PWMRANGE);
Expand Down

0 comments on commit a77a49c

Please sign in to comment.