int main() { try { run_with_time_limit( []() { std::thread controller_thread( &controller ); so_5::launch( []( so_5::environment_t & env ) { std::cout << "Starting agents..." << std::endl; environment.store( &env, std::memory_order_release ); for( unsigned int i = 0; i < agents_count; ++i ) { std::ostringstream ss; ss << "coop_" << i; env.register_agent_as_coop( ss.str(), new a_test_t( env ) ); } }, []( so_5::environment_params_t & params ) { params.disable_autoshutdown(); } ); environment.store( nullptr, std::memory_order_release ); controller_thread.join(); }, 20, "SO Environment autoshutdown disabled test" ); } catch( const std::exception & ex ) { std::cerr << "Error: " << ex.what() << std::endl; return 1; } return 0; }
int main() { usb_workaround(); // because the arduino bootloader is a piece of shit init_controller(&SControl); blinky(); // zero the motor for (int i = 0; i < 945; i++) { advance_motor(&(SControl.MControl), UP); _delay_us(3000); } SControl.MControl.current_pos = 0; initInput(); sei(); while (true) { controller_thread(&SControl); input_thread(&SControl); } /* while (true) { set_gauge_target(&SControl, (315<<4)); while (SControl.MControl.current_pos != SControl.target_pos) controller_thread(&SControl); set_gauge_target(&SControl, (0)); while (SControl.MControl.current_pos != SControl.target_pos) controller_thread(&SControl); platform_toggle_status_led(); } */ return 0; }