gen.add("odom_covar_angle", double_t, 0, "Odometry covariance: rotation", 0.25, 1e-6, 6.2832)
gen.add("rollover_protect", bool_t, 0, "Enable motor rollover protection on pitch", True)
gen.add("rollover_protect_limit",double_t, 0, "Pitch rollover protection limit (degree)", 45, 0, 90)
-gen.add("rollover_protect_pwm", double_t, 0, "Pitch rollover protection speed (pwm)", 100, 0, 255)
+gen.add("rollover_protect_pwm", double_t, 0, "Pitch rollover protection speed (pwm)", 255, 0, 255)
exit(gen.generate("wild_thumper", "wild_thumper", "WildThumper"))
self.pub_range_left = rospy.Publisher("range_left", Range, queue_size=16)
self.pub_range_right = rospy.Publisher("range_right", Range, queue_size=16)
self.cmd_vel = None
+ self.cur_vel = (0, 0)
self.bMotorManual = False
self.set_speed(0, 0)
rospy.loginfo("Init done")
i+=1
if self.cmd_vel != None:
self.set_speed(self.cmd_vel[0], self.cmd_vel[1])
+ self.cur_vel = self.cmd_vel
self.cmd_vel = None
rate.sleep()
return config
def imuReceived(self, msg):
- if self.rollover_protect:
+ if self.rollover_protect and any(self.cur_vel):
(roll, pitch, yaw) = tf.transformations.euler_from_quaternion(msg.orientation.__getstate__())
if pitch > self.rollover_protect_limit*pi/180:
self.bMotorManual = True
elif self.bMotorManual:
i2c_write_reg(0x50, 0x1, struct.pack(">hhhh", 0, 0, 0, 0))
self.bMotorManual = False
+ self.cmd_vel = (0, 0)
rospy.logwarn("Rollver protection done")
def get_reset(self):