input: Write a python function to generate a straight pin using CadQuery.
  assert generate_straight_pin(params, True) is not None
  assert generate_straight_pin(params, False) is not None
output: def generate_straight_pin(params, render):
      import cadquery as cq
      
      # Parameters for the pin
      pin_length = params.get('length', 10.0)
      pin_diameter = params.get('diameter', 1.0)
      head_diameter = params.get('head_diameter', 2.0)
      head_height = params.get('head_height', 1.0)
      
      # Create the pin body
      pin = cq.Workplane("XY").circle(pin_diameter / 2).extrude(pin_length)
      
      # Create the head
      head = (
          cq.Workplane("XY")
          .circle(head_diameter / 2)
          .extrude(head_height)
          .translate((0, 0, pin_length))
      )
      
      # Combine the pin and head
      straight_pin = pin.union(head)
      
      if render:
          show_object(straight_pin)
      
      return straight_pin