This paper investigates the optimal data transmission for collaborative driving in autonomous vehicular networks (AVNs). We consider that vehicles communicate with each other based on the definition of Robot Operating System (ROS), which is a pervasively adopted middleware operating system for autonomous vehicles such as Baidu Apollo. ROS defines a publish/subscribe scheme for inter-vehicular communications, in which vehicles subscribe to “topics” published by adjacent vehicles; a “topic” is related to the real-time sensing/computing data that a vehicle intends to share with nearby neighbors, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">e.g.</i> , radar or camera images captured. By sharing various sensing data using different topics at the real-time, vehicles in the same area therefore can collaboratively drive with cooperative perception and computing. However, multiple data flows for different topics would coexist along overlapping transmission paths during this process. As a result, a fundamental issue raised is how to schedule the contending data flows in the mobile and bandwidth-constrained vehicular networks. In this paper, we model the ROS-based publish/subscribe scheme as an optimization problem which jointly considers the power allocation and conflict avoidance of the communication process in AVNs. By applying the Lyapunov Optimization, we decompose the model to calculate the power and sub-carrier proportion on each node while avoiding link conflicts, and finally obtain the optimal resource allocation strategy. By combining the corresponding link conflict constraints, we are able to encapsulate the optimization model in a stable set to efficiently avoid link conflicts, and thereby reduce the resource waste caused by the link interference and data flow conflicts. Using simulations, we show that our method has good advantages in resource optimization.