Generally we try to give our posts meaningful titles but we couldn’t resist coining our slightly deranged golfing challenge device the “Gripper Pipper”. It’s a simple device at the front of Mr. Bit to grip a golf ball then hit (or rather “pip”) when releasing.
The gripper is a 3D printed claw modelled in Tinkercad, it has a basic cog/gear mechanism and screws directly onto Mr Bit’s chassis. We’ve used a servo connected to port 18 on the Pi configured to PWM (see code below) and the power to the 5V and GND rail. The servo turns one side of the gripper to open and close it to our configured min and max servo pulse values.
The Pipper is a 6v, 20N, 10mm push solenoid which is fitted underneath Mr Bit. It’s connected via a relay direct to the battery (slightly higher than 6v but it should be ok for the little pips we will be doing). The relay itself is a Seeedstudio Grove component and so we’ve connected it to our GrovePi although any other relay could be connected directly to the Pi.
When the Gripper opens to a certain width the Pipper activates an hits the ball. We don’t know what to expect from the slightly deranged golf course but we did read there may be a windmill type obstacle and the Pipper’s purpose to get the ball through any holes which may be in our way. There’s only a 10mm push and it’s not that strong but we’re hoping it will be enough.
We’ve configured this to our game controller and have the option of gripping, pipping or gripping and pipping automatically on release. The following class describes the implementation and has grip, release, fully open, fully close, pip, release and pip methods which we have bound to various button presses on the controller. An instance of Gripper Pipper cab be created with the following code:
import wiringpi as wp
import grovepi as gp
""" Controls the Mr Bit's Gripper Pipper for the Slightly Deranged Golf """
""" creates an instance of Gripper Pipper, requires wiringpi and grovepi
(only reuires grovepi if using grove relay).
self.gripperPin = 18
self.pipperPin = 2
self.wp = wp
self.gp = gp
self.maxPulse = 168
self.minPulse = 100
self.pulseDelay = 10 #time in microseconds it takes to move servo 1 pulse
def set_position(self, Pulse):
""" Sets the servo position of the gripper
A PWM value in the range of 50 - 250 which is servo range.
self.pulse = Pulse
if self.pulse < self.minPulse:
self.pulse = self.minPulse
elif self.pulse > self.maxPulse:
self.pulse = self.maxPulse
" Will close the gripper when called in single pulse increments "
if self.pulse == self.maxPulse: return False
Pulse = self.pulse + 1
""" will open the gripper when called in single pulse increments """
if self.pulse == self.minPulse: return False
Pulse = self.pulse - 1
""" Fires the selenoid """
""" Opens the gripper fully then fires the selenoid """
""" Will open the gripper fully """
while self.release() is not False:
""" Will close the gripper fully """
while self.grip() is not False:
To get all of this to work we’ve had to use some different wheels than our normal set. This has become a theme of Mr. Bit – different wheels for different challenges. These wheels are cheap neoprene ones from Lynxmotion but give good grip and height for this challenge. We think the extra width of the wheels and the Gripper Pipper makes Mr. Bit look beefier when he’s in his golf buggy mode.
We were hoping that this device, with bigger gripper, might work for the skittles challenge too but there’s no way this pipper will be able to pip anything bigger than a golf ball. For the skittles we’ll just have to create a bulldozer type fitting on the front of Mr. But to ram the ball towards the skittles.