Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- wb_robot_init();
- WbDeviceTag motor = wb_robot_get_device("my_motor");
- double F = 2.0; // frequency 2 Hz
- double t = 0.0; // elapsed simulation time
- while (wb_robot_step(TIME_STEP) != -1) {
- double pos = sin(t * 2.0 * M_PI * F);
- wb_motor_set_position(motor, pos);
- t += (double)TIME_STEP / 1000.0;
- }
- wb_robot_cleanup();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement