Skip to content
Snippets Groups Projects
Commit 7260078b authored by Stevedan Ogochukwu Omodolor's avatar Stevedan Ogochukwu Omodolor
Browse files

radius adjusted to compensate velocity control

parent ded0127e
No related branches found
No related tags found
No related merge requests found
...@@ -5,9 +5,9 @@ channel: 90 # change to the correct one ...@@ -5,9 +5,9 @@ channel: 90 # change to the correct one
type: default type: default
position_offset: 0.11 # ofsset from crazyflie module to the cenyter of the omniwheels position_offset: 0.11 # ofsset from crazyflie module to the cenyter of the omniwheels
R: 0.0165 R: 0.0165
r: 0.003 r: 0.00065 #this does not match the real wheelradius
kp: 0.1 kp: 0.1
ki: 0.01 ki: 0.0
rate_hz: 50 # rate of the control loop rate_hz: 50 # rate of the control loop
...@@ -106,7 +106,8 @@ class omniWheelvelocityController: ...@@ -106,7 +106,8 @@ class omniWheelvelocityController:
vel_ref = np.array([self.vel_cmd.linear.x, self.vel_cmd.linear.y, self.vel_cmd.angular.z]) vel_ref = np.array([self.vel_cmd.linear.x, self.vel_cmd.linear.y, self.vel_cmd.angular.z])
error = vel_ref - np.array([self._current_vel.linear.x, self._current_vel.linear.y, self._current_vel.angular.z]); error = vel_ref - np.array([self._current_vel.linear.x, self._current_vel.linear.y, self._current_vel.angular.z]);
xdot = vel_ref + self.pi.update_control(error) xdot = vel_ref + self.pi.update_control(error)
ph = self.vel2motor(xdot, np.deg2rad(yaw)); ph = self.vel2motor(vel_ref, np.deg2rad(-180));
#print(np.rad2deg(yaw))
self.motor_command[0] = ph[0] self.motor_command[0] = ph[0]
self.motor_command[1] = ph[1] self.motor_command[1] = ph[1]
...@@ -163,7 +164,7 @@ class omniWheelvelocityController: ...@@ -163,7 +164,7 @@ class omniWheelvelocityController:
self._current_pose = data; self._current_pose = data;
self.pose_callback_initiated = True; self.pose_callback_initiated = True;
def vel2motor(self,xdot, ang): def vel2motor(self,xdot, ang):
M = 1/self.r*np.array([[-np.sin(ang), np.cos(ang), self.R ],[-np.sin(ang+self.a1), np.cos(ang+self.a1), self.R],[-np.sin(ang+self.a2), np.cos(ang+self.a2), self.R]]) M = -1 /self.r*np.array([[-np.sin(ang), np.cos(ang), self.R ],[-np.sin(ang+self.a1), np.cos(ang+self.a1), self.R],[-np.sin(ang+self.a2), np.cos(ang+self.a2), self.R]])
return M.dot(xdot) return M.dot(xdot)
#return M.dot(xdot) #return M.dot(xdot)
......
here
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment