You could use a digital potentiometer in the feedback path of a voltage regulator.
From Analog Devices MT-091:
Because they are
digitally controlled, digital pots can be used in active control applications, in addition to basic
trimming or calibration applications. For example, digital pots can be used in programmable
power supplies as shown in Figure 8A. Typical adjustable low dropout voltage regulators (such
as the anyCAP series) have a FB pin, where applying a resistor divider yields a variable output
voltage. As shown, R1 and R2 are the feedback and input resistors, respectively. The FB circuit
has an internal non-inverting amplifier which gains up a 1.2-V bandgap reference to the desired
output voltage.
A solar panel is not a constant voltage, or constant current source. It can be thought of as a constant power source with maximum rated voltage and maximum rated current. The power is relative to the light hitting the panel, the voltage is maximum with no current, and drops as current is drawn from the panel.
If you are using a 10W panel, and it's in its full rated sun exposure, you'll get 10W out.
If you draw 1A in that situation, the voltage will be about 10V. If you draw two amps, the voltage will be about 5V.
If your battery is full, you probably aren't going to draw much current, so the voltage is higher.
If the battery is nearly empty, it will draw a lot of current, and it will cause the panel's voltage to drop.
In your specific case, what you're finding is that the panel can't provide full charging current all the time - whether that's due to less than full sun exposure, or a low-charge battery depends on the situation.
However, you can still use this system, even though the voltage is low. If you disconnect the battery and measure its voltage, then connect it to the charging system and measure the voltage at the battery, you'll find that the attached voltage is higher - the battery is accepting current from the system, and is charging. It isn't charging as fast as it could be, but that's due to the panel's limitations.
If you want to learn more about this, and what professional solar charging systems do in order to handle this effect, do a search for MPPT circuits - maximum power point tracking. The solar panel is most efficient at a certain voltage and current for a given sunlight input, and these circuits attempt to track that maximum point so you get as much power from the panel as possible.
Also, note that SLA batteries are very forgiving. It may be that you can eliminate the voltage regulator, and just use the diode in the circuit. This will increase the voltage at the battery since the regulator drops 1.5V-3V depending on load, and thus charging efficiency. Given that you're having a hard time keeping it charged, I'd expect the solar panel is unlikely to damage the battery, but check the panel's maximum current at 7.2V and see if the battery can accept a constant trickle charge of that rate.
Best Answer
Output voltage and voltage regulating are two different things. The second should be done by the regulator.
This is how you can achieve the first if you're using a LM317:
With digital outputs:
And the potentiometer variant: