def construct_trajopt_request(d_list, n_steps, arm_name, joint_start, joint_target):
    """Constructs a TrajOpt planning request dictionary using the provided
    distance hit-in penalties"""
    padding = int(n_steps / 2)
    request = {
        "basic_info": {
            "n_steps": n_steps,
            "manip": arm_name,
            # DOF values at first timestep are fixed at current robot state
            "start_fixed": True
        },
        "costs": [
            {
                "type": "joint_vel",  # joint-space velocity cost
                # a list of length one is automatically expanded
                # to a list of length n_dofs
                "params": {"coeffs": [50]}
            },
            {
                "type": "collision",
                # shorten name so printed table will be prettier
                "name": "disc_coll",
                "params": {
                    "continuous": True,
                    # penalty coefficients. list of length one is automatically
                    # expanded to a list of length n_timesteps
                    "coeffs": [50],
                    # robot-obstacle distance that penalty kicks in.
                    # expands to length n_timesteps
                    "dist_pen": list(d_list)
                }
            }
        ],
        "constraints": [
            # BEGIN joint_constraint
            {
                "type": "joint",
                "params": {"vals": joint_target}

            }
        ],
        # BEGIN init
        "init_info": {
            # straight line in joint space.
            # "type": "straight_line",
            # "endpoint": joint_target
            "type": "given_traj",
            "data": [joint_start] * padding + [joint_target] * (n_steps - padding)
        }
        # END init
    }

    return request