SHARE
TWEET

Untitled

a guest Oct 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main() {
  2.   wb_robot_init();
  3.  
  4.   WbDeviceTag motor = wb_robot_get_device("my_motor");
  5.  
  6.   double F = 2.0;   // frequency 2 Hz
  7.   double t = 0.0;   // elapsed simulation time
  8.  
  9.   while (wb_robot_step(TIME_STEP) != -1) {
  10.     double pos = sin(t * 2.0 * M_PI * F);
  11.     wb_motor_set_position(motor, pos);
  12.     t += (double)TIME_STEP / 1000.0;
  13.   }
  14.  
  15.   wb_robot_cleanup();
  16.  
  17.   return 0;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top