Robot iOS App - Beta Release¶
DISCLAIMERS¶
-
Safety: Always make sure you operate in a safe environment. Keep in mind, that your phone could be damaged in a collision! Special care is necessary when using automated control (e.g. person following or driving policy). Make sure you always have a game controller connected and are familiar with the key mapping so you can stop the vehicle at any time. Use at your own risk!
-
App under development: The application is under development and may crash or exhibit unexpected behaviour depending on your phone model and version of the operating system. Make sure to test all functionalities with no wheels connected. Use at your own risk!
-
The app will be
availablesoon on theApp Store.
App Screens¶
Main Menu¶
The app starts with a menu screen that shows all available screens. The Bluetooth connection screen can be opened by clicking on the Bluetooth icon on top right hand side. The settings screen can be opened with a click on the settings icon right next to it. By clicking on the other icons, the user can access various screens whose functionalities are explained in subsequent sections.
The bottom of the app displays a tab bar with tabs for Home, Projects, and Profile. By default, the Home tab is displayed. If a user is logged in, all their saved projects in the "openbot-opencode" folder on Google Drive will be listed in Projects tab. The Profile tab includes buttons for accessing the user's profile and signing out.
Bluetooth Connection¶
Unlike the Android app, which allows connecting the smartphone to the low-level control board of an OpenBot via a USB cable, the iOS app relies solely on a Bluetooth Low-Energy (BLE) wireless connection. When opening the Bluetooth connection screen in the iOS application (by clicking on the bluetooth logo from the main screen or from any fragment), a list of all compatible devices is displayed. Compatibility is here enforced by using a range of specific UUIDs assigned to an OpenBot vehicle at both the app and firmware levels. You must ensure that these UUIDs match. Pairing an iOS device to an OpenBot vehicle then simply requires to select that vehicle from the list and press the "Connect" button. The default baud rate for the connection is set to 115200 and can be changed at the app and firmware level.
Multi-Language Support¶
Open the settings screen with the gear icon at the top right and tap Language in the General section to choose the display language of the app. Select System Default to follow the language of your iPhone, or pick one of the supported languages: English, Deutsch, Español, Français, 中文, 한국어 or हिन्दी. The app applies the new language right away.
Web Signaling Server¶
In the settings screen, enter the WebSocket address of the signaling server in the Web Signaling Server field, for example ws://<server-ip>:8080/ws. It is used when the control mode is set to web server, so your iPhone and the server need to be on the same Wi-Fi network. See the web server for how to set it up.
Free Roam¶
Free Roam offers simple robot control with real time updates and information about battery, speed and distance from surfaces. It also offers controls related to controller, drive mode and speed.
-
Battery: The battery icon shows realtime battery levels of the connected robot.
-
Drive Mode: There are 3 drive modes displayed on the view:
-
D -> Drive, when the robot is driving forward
-
N -> Neutral, when the robot is stationary
-
R -> Reverse, when the robot is moving backwards
-
Speed: The speedometer shows the realtime speed of the robot.
-
Sonar: The sonar view distance of robot from an oncoming object in cm.
-
Bluetooth: Shows the status of bluetooth connection with the microcontroller. on tapping the icon, the user can also be redirected to the Bluetooth screen to view/modify the connection.
Control¶
The first button is for selecting the control mode. There are two different control modes:
- Gamepad: The app receives controls from a connected BT controller.
- Phone: The robot can be controlled via another smartphone with the controller app installed or though a Python script running on a computer connected to the same network.
The second button is for selecting the drive mode. There are three different drive modes when using a game controller (e.g. PS4):
- Game: Use the right and left shoulder triggers (R2, L2) for forward and reverse throttle and either joystick for steering. This mode imitates the control mode of car racing video games.
- Joystick: Use either one of the joysticks to control the robot.
- Dual: Use the left and right joystick to control the left and right side of the car. This is raw differential steering.
The third button is for selecting the speed mode. There are three different speed modes:
- Slow: The voltage applied to the motors is limited to 50% of the input voltage (~6V).
- Normal: The voltage applied to the motors is limited to 75% of the input voltage (~9V).
- Fast: There is no limit. The full input voltage will be applied to the motors at full throttle (~12V). This is the default setting for running the neural networks.
Running at higher speeds will reduce the lifetime of the motors but is more fun. The controls that are sent to the robot are displayed on the right side. When using the game controller, the speed mode can be increased by pressing down the right joystick (R3) and decrased by pressing down the left joystick (L3).
Data Collection¶
Simple UI for collection of data sets.
-
Preview Resolution: Used to switch between resolutions of camera preview. There are 3 settings:
-
HIGH (1920x1080p)
-
MEDIUM (1280x720p)
-
LOW (640x360)
-
Model Resolution: Used to switch between resolutions of images saved for training different models.
-
Server: Server functionality is under Development.
-
Log Collected Data: the data collection process can be controlled from the screen or remotely, for instance from a bluetooth controller. When using a bluetooth controller, you may:
-
press the A button to start the data collection process
-
press the A button again to stop data collection and save the collected data in a .zip file
-
alternatively press the R1 button to stop data collection without saving the collected data (for instance because of an unexpected collision with the environment)
-
remember to use the controller mapping fragment to ensure you are using the correct buttons.
-
Vehicle Status: The field Battery displays the battery voltage as measured by the microcontroller via the voltage divider. The field Speed (l,r) reports the left and right speed of the (front) wheels in rpm. It is measured by the microcontroller via the optical wheel speed sensors. The field Sonar shows the free space in front of the car in centimeters. It is measured by the microcontroller via the ultrasonic sensor. Note, you will only receive values a few seconds after the USB connections has been established.
-
Sensors: Reports measurements from vehicle sensors. Currently, we record readings from following sensors: camera, gyroscope, accelerometer, magnetometer, ambient light sensor, and barometer. Using the iOS API, we are able to obtain the following sensor readings: RGB images, angular speed, linear acceleration, gravity, magnetic field strength, light intensity, atmospheric pressure, latitude, longitude, altitude, bearing, and speed. In addition to the phone sensors, we record body sensor readings (wheel odometry, obstacle distance and battery voltage), which are transmitted via the serial link. We also record and timestamp control signals received from a connected controller, if present. Lastly, we integrate several neural networks for person following and autonomous navigation.
Controller Mapping¶
Simple UI to check the button and joystick mapping of a connected BT controller.
Robot Info¶
Simple UI to get robot info and test basic functionality. The Robot Type as configured in the firmware is displayed as text and animation. The checkmarks in the sections Sensors, Wheel Odometry and LEDs show which features are supported by the connected robot. The section Readings provides the most important sensor measurements. In the section Send Commands, users can send basic motor commands by pressing the corresponding buttons and control the front and rear LEDs with a slider.
Autopilot¶
Simple UI for running autopilot models.
- Server: If you have the web app for policy training running, you can select it here and send trained autopilot models to the robot.
- Model: Choose a trained model to use for autopilot mode.
- Device: Use CPU, GPU or NNAPI for inference (more details here).
- Threads: Number of threads to use (only makes a difference when CPU is selected as device).
- Control: Controller, Drive Mode and Speed are used to control robot settings as described in the control section.
Object Tracking¶
Simple UI for tracking objects of 80 different classes. A short description of the different AI models for object tracking and performance benchmarks can be found in Model Management.
- Dynamic Speed: reduces the robot speed in "Auto Mode" if it gets closer to the tracked object. The speed is scaled based on the area of the bouding box (works best in landscape orientation).
- Model: Choose an object detector based on your phone performance.
- Object: Pick the object you want to track. The models can detect the 80 COCO object classes.
- Confidence: Confidence threshold to determine if detections are accepted. Increase if you get false detections, decrease if the object of interest it not detected.
- Device: Use CPU, GPU or NNAPI for inference (more details here).
- Threads: Number of threads to use (only makes a difference when CPU is selected as device).
- Control: Controller, Drive Mode and Speed are used to control robot settings as described in the control section.
Model Management¶
All models are quantized for better performance on embedded devices. Note that models with larger input resolution might be better for smaller objects despite lower mAP.
Navigation¶
The Point Goal Navigation screen lets you pick a spot on the floor for the robot to drive to. To access this screen, simply tap on the corresponding button in the app.
Mount the phone on the robot, put the robot on the floor and move it a little until ARKit finds the floor. Then tap the spot on the floor in the camera view where the robot should go; a marker shows the goal. Taps on furniture, walls or other objects above the floor are rejected; tap the same spot again to place the goal on the floor below it.
Startbutton: starts the navigation. The robot drives towards the goal and adjusts its trajectory and speed as needed to reach it.Stopbutton: stops the robot at any time.
If the robot successfully reaches the goal location, a message will appear indicating that the goal has been reached, and the robot will stop moving.
Note that this feature uses ARKit, a framework developed by Apple for augmented reality applications. The user will need to have an ARKit-compatible device to use this feature.
Projects Screen¶
The Projects Screen displays a list of your OpenBot Playground projects if you are signed in with your Google account. You can execute these projects to connect with your OpenBot, or scan their QR codes by clicking the scanner icon in the top right corner. If you are not signed in, the screen will display a Google Sign-In button, but you can still scan your project's QR code without signing in. If you get the message Oops, no project found on the screen after signing in, make sure that the account has projects stored on Google Drive.
If you don't see your latest projects in the project list, you can reload them by pulling down on the project screen.
-
Google Drive projects: To run a Google Drive project, tap on the project you want to execute and wait for the contents of the project file to be read. If the file is successfully retrieved without any errors, a pop-up will appear with two buttons:
StartandCancel. The pop-up will also display the name of the project you are about to run. To execute the project, click on the Start button. If you want to stop the activity, click on the Cancel button. If you receive a pop-up message statingSomething went wrong, there may be an error with the Google Drive file. To resolve this issue, refresh the project screen by pulling down and then repeating the same process. -
Qr code scanner: To scan the QR code of a Playground project, click on the QR code icon located in the top right corner of the screen. Grant camera access to the app so that it can scan the QR code. Once the code is scanned, wait for the contents of the file to be read. If the file is retrieved successfully without any errors, a pop-up will appear with two buttons:
StartandCancel. The pop-up will also display the name of the project you are about to run. To execute the project, click on the Start button. If you want to stop the activity, click on the Cancel button. If you receive a pop-up message statingSomething went wrong, there may be an error with the Google Drive file. To resolve this issue, generate a new QR code in Playground and repeat the process. -
Executing Project: If your OpenBot Playground project runs successfully, the screen will display the names of code blocks along with a stop button that can be used to stop the execution of playground block commands.
-
Delete Project: To delete a project, long-press on the project you wish to delete. This will bring up a popup screen asking to confirm the deletion. Tap on 'Yes' to delete the project.
Profile Screen¶
The Profile Screen in the app provides different options based on whether the user is signed in or not.
If the user is not signed in, a Google Sign-in button will appear, prompting the user to sign in their Google account. Once signed in, the user will be able to access their profile and other features.
If the user is signed in, two buttons will be listed in the Profile tab: Edit Profile and Logout.
-
Edit Profile: Tapping on this button will open a new screen where the user can update their profile information, such as their name and profile picture.
-
Logout: This button allows the user to log out of their account. Tapping on this button will log the user out and return them to the login screen.
OpenBot PlayGround Screen¶
To access OpenBot Playground services, click on the OpenBot Playground icon located at the top of the screen in project's screen toolbar options. If you want to learn more about OpenBot Playground, Click here.
Code Structure¶
The TensorFlow Lite Object Detection iOS Demo was used as starting point to integrate TFLite models and obtain the camera feed. The tflite folder contains the model definitions for the Autopilot and Detector networks.
Next (optional)¶
Train your own Driving Policy
Firebase Authentication Firebase