Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions projects/samples/howto/gears/controllers/gears/gears.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

#define TIME_STEP 8

int main(int argc, char **argv) {

#define SPEED 0.3
int main(int argc, char **argv)
{

wb_robot_init();

WbDeviceTag motor = wb_robot_get_device("rotational motor");
Expand All @@ -38,9 +42,9 @@ int main(int argc, char **argv) {
double pos = wb_position_sensor_get_value(sensor);

if (pos >= M_PI / 4)
wb_motor_set_velocity(motor, -0.2);
wb_motor_set_velocity(motor, -2 * SPEED);
if (pos <= -M_PI / 4)
wb_motor_set_velocity(motor, 0.2);
wb_motor_set_velocity(motor, VITESSE);
}

wb_robot_cleanup();
Expand Down