function COG = RobCOG( COG_r,COG_rl,COG_l,M )

 %-- Constants and parameters ---------------------------------------------
  m0 = M(1); m1 = M(2); m2 = M(3); m3 = M(4); 
  Mt = 2*m0+2*m1+2*m2+m3;
 %-- Centre of Gravity (COG) ----------------------------------------------
  CMi = [COG_r COG_rl COG_l];
  Mi  = [m0 m1 m2 m3 m2 m1 m0];
  Mi = repmat(Mi,3,1);
  
  COG = sum(CMi.*Mi,2)/Mt;
 %-------------------------------------------------------------------------
end