The increasing demand for goods, especially in urban areas, together with the technological advances are creating both opportunities and challenges for planning urban freight systems. One of these promising opportunities is to use the underused assets in people-based systems to transport goods. In this paper, we consider an integrated system in which a set of freight requests needs to be delivered using a fleet of grounded, and autonomous, pickup and delivery (PD) robots where a public transportation service (referred to as scheduled line (SL)) can be used as part of PD robot's journey. Passengers and PD robots (carrying freight) share the available capacity on SLs where passengers are prioritised, and their transport demand is stochastic. Thus the number of available places for PD robots is only revealed upon shuttle arrival to the corresponding SL station. We first formulate this problem as a Pickup and Delivery Problem with Time Windows and Scheduled Lines (PDPTW-SL). We then introduce a sample average approximation (SAA) method along with an Adaptive Large Neighbourhood Search (ALNS) algorithm for solving the stochastic optimization problem. Finally, we present an extensive computational study, analyse its results and give some directions for future research.