JavaWebots controller directly call the real API implementation while other onesare linked with their corresponding wrapper API that eventually map the theJava implementation.If the remote mode is started then, instead of loading a robot controller,the launcher starts the remote controller that open a TCP socket to receiveand send remote control commands.3.2 DevicesIn Android almost everything works with events and callbacks, therefore it isnot possible to control exactly when a sensor gets a new value. The Preference activity can be startedby the user to show the settings screen.When the user chooses a controller from the main activity, it sends thecontroller name to the service which in turn starts the controller activity.This activity is used to show another screen that will hold the Webots displaydevice, touchscreen sensors, and also provide a menu to start and stop thecontroller.When the robot controller is actually started by the menu of the controlleractivity, the launcher loads the necessary libraries and starts the controllerin the appropriate manner depending of its programming language. The mainactivity also starts the TCP server. It binds the service,which is started in another process by the android framework. On the main process the main activity is started first. This component is bound by the main activity and canexchange messages with it.The following graph shows the relation between the components of theapplication :Main processPreference ActivityTCPServerMain ActivityPCController processIPCController ServiceTCPRemoteControllerController ActivityWebots Java APIController libraråontroller LauncherWebots C APIWrapperRobotControllerWebots C++ APIWrapperWebots Python APIWrapperFigure 7: Application graph13 To have better flexibilitya Service is used. Activities cannot communicatewith IPC except to return a result value on exit. ![]() ![]() It isthe same principle as in Webots where controllers are also run in their ownprocesses.In android it is not possible to directly start a process but an activity (orservice) can be set to run in a different process. Italso allows to ensure complete reset when launching another controller. Having a dedicated process for the controller avoid crashingand corrupting the whole application in case of problem with a controller.
0 Comments
Leave a Reply. |