In this work, we study task partitioning in the context of swarm robotics. Task partitioning refers to the decomposition of a task into sub-tasks that can be tackled by different workers. In this work, we focus on the case in which a task is partitioned into a sequence of sub-tasks that must be executed in a certain order. This implies that the sub-tasks must interface with each other, and that the output of a subtask is used as input for the sub-task that follows. A distinction can be made between task partitioning with direct transfer and task partitioning with indirect transfer. We focus our study on the first case: the output of a sub-task is directly transferred from an individual working on that sub-task to an individual working on the sub-task that follows. As a testbed for our study, we use a swarm of robots performing foraging. The robots have to harvest objects from a source, situated in an unknown location, and transport them to a home location. When the source is found, the robots memorize its position and use dead-reckoning to return there. Dead-reckoning is appealing in robotics, since it is a cheap localization method and it does not require an additional external infrastructure. However, it leads to errors that grow unbounded in time if not corrected periodically. We compare a strategy that does not make use of task partitioning to one in which object retrieval is partitioned into sub-tasks and the objects are directly transferred between the robots. We show that cooperation through task partitioning can be used to limit the effect of dead-reckoning errors. This results in an improved capability of locating the object source and in an increased performance of the swarm. We use the implemented system as a testbed to study benefits and costs of task partitioning with direct transfer. We implement the system with real robots, demonstrating the feasibility of our approach in a foraging scenario.