Skip to content
Snippets Groups Projects
Commit 7b31eecd authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Updated the actuators example to accept the desired speed and steering angle as an argument.

parent 2645d0ea
No related branches found
No related tags found
1 merge request!1Sergi
......@@ -15,16 +15,24 @@ int main(int argc, char *argv[])
act_driver = new CModelCarActuators(name);
act_driver->open();
act_driver->disable_ultrasounds();
if(argc!=3)
{
std::cout << "Insufficient arguments. Usage:" << std::endl;
std::cout << " model_car_actuators_test speed steering angle" << std::endl;
std::cout << " speed: a value between -100 and 100 corresponding to the minimum and maximum speeds" << std::endl;
std::cout << " steering: a value between -100 and 100 corresponding to the minimum and maximum steering angles" << std::endl;
return 0;
}
else
{
vx=std::stod(argv[1]);
steer=std::stod(argv[2]);
}
std::cout << "model_car_actuators_test::main: about to test speed, in 3..." << std::endl;
sleep(1);
std::cout << "model_car_actuators_test::main: about to test speed, 2..." << std::endl;
sleep(1);
std::cout << "model_car_actuators_test::main: about to test speed, 1..." << std::endl;
sleep(1);
act_driver->disable_ultrasounds();
std::cout << "model_car_actuators_test::main: sending speed 10" << std::endl;
std::cout << "model_car_actuators_test::main: sending speed " << vx << " and steering " << steer << std::endl;
/*
for(unsigned int i=0;i<100;i++)
{
usleep(100000);
......@@ -34,6 +42,13 @@ int main(int argc, char *argv[])
act_driver->send_command(vx,steer);
}
act_driver->send_command(0.0,0.0);
*/
while(1)
{
usleep(100000);
act_driver->send_command(vx,steer);
}
act_driver->send_command(0.0,0.0);
act_driver->close();
delete act_driver;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment