Did you know that all Totem robots can have custom functionality and controls? In this blog post we will discover what capabilities are available within our system.
Totem robots use our developed electronics to control motors and other accessories. These electronics can connect to mobile application via Bluetooth and let user to create his custom set of controls. Yet so far this function is only available on Android.
Let’s start with the types of control boards that we provide:
This board provides Bluetooth connection to Totem bus system. It allows to connect multiple function boards (buttons, switches, sensors) and control each functionality individually. You can read more about this bus system in TOTEMBUS: MQTT IN TOTEM blog post.
Integrated board that has Bluetooth connection, 4 DC motor channels and 2 Servo motor channels. It’s handy for small projects that require only motor controls.
For RoboBoard X4 set up please refer to this page:
Creating your robot
Let’s say, you would like to create some sort of robot that has 2 wheels attached to DC motors and 1 Servo motor for some kind of operation (like flipper in Mini Trooper). The schematic would look like this:
So, we have a robot with configuration:
Left wheel – connected to DC A Channel;
Right wheel – connected to DC B Channel;
Flipper – connected to Servo A Channel.
Now connect a battery, open your Totem Android application, connect to the robot and let’s get started!
When connected, firstly hit EXPLORE button and you will be welcomed with the list of connected boards.
List will include all boards (function boards) that are discovered in Totem bus system (in Robotic Arm you will see 2 items in the list). In case of X3-FBI board, there will be only one item “Multiple Motor”.
Sometimes you may see “No function board attached” as an item in the list. It means there is a baseboard in Totem bus without function board snapped on top of it, or function board firmware is missing. Make sure that “Download firmwares from cloud” is enabled and application automatically flashes all missing firmwares for each function board.
Secondly, by clicking Multiple Motor item, a list shows up with all available functionality for this function board. In this case we are interested in “/0/dc/power_” and “/0/serv/pos_” items. “PowerA” maps to DC Channel A and “posA” maps to Servo Channel A.
If you click on one of the items, a popup with slider will appear. There you can test particular channel and watch how motor reacts to a raw value. Values in there are from -100 to 100. -100 means backward max power, 100 – forward max power, 0 – stopped (no power).
Creating custom model
In the main screen we have a list of Models. 4 of them are already created by us for our products (you may have already used these before).
To delete a model – click on it and hold.
To create a new Model, click + button in the corner.
Enter your model name and click + button again to add a new widget.
A list of available widgets will be visible:
• Slider – you can set the specific value;
• Button – does an action when pressed on;
• Toggle – switches between two values;
• Joystick – controls precisely;
• DigitalSlider – slider that can be adjusted incrementally.
Press on the Button widget and drag it to the screen.
You can rearrange views as you like. Also changing size is available when pressing arrow on the corner.
Moreover, you can edit your buttons while edit mode is selected on the top right corner.
You can find a widget configuration in the button edit window (on the top right corner). There you can change button name (for example – FLIP) to easier identify its function.
Now let’s change names for all buttons and start editing a “Go” button.
And we are ready to assign motors to created buttons. To do so, in button edit window click ADD TOPIC. In “Select function board” screen there will be a list of all available function boards. Note: you must be connected to the robot. Otherwise no boards will be displayed.
In case of Robot Arm, there will be 2 boards displayed, but in our example only X3-FBI board is shown. Select it (to mark violet) and click Next.
In “Select function” we can see a similar screen, which is already familiar from “explore view” that we discussed earlier. To assign motor to button, select “dc/powerA” (which is our left motor) from the list and click Next. Also, you may click a circle over port inside the board image. It has same functionality as clicking on the item in the list.
In “Fine tune controls” screen some function customisations can be made, but we will set required parameters later. Finally, click Done button.
Success! We mapped out left motor to “Go” button. Now repeat the same steps to add right motor “dc/powerB”. We should see POWERA and POWERB functions listed inside our “Go” button.
When done, click Save and if we try to press “Go” button (remember to swith to play), both wheels start to spin in different directions. Releasing button doesn’t help either, wheels will swap the spinning direction and also won’t stop spinning. This happens because we haven’t configured our added functions and therefore application won’t know how motors should react to a button press.
To fix this situation, let’s edit “Go” button again.
We need to adjust slider’s “Range” to the correct position and set the correct spinning direction “Inverted”.
The “Range” slider values are between -100% and 100% power. You have 2 points that can be set in each direction. When button is pressed, it sends right point value to the robot (in our case 100%) and on release – left point value (-100%). This is why the wheel will not stop spinning after releasing a button.
For left wheel (POWERA), we just need to set left point to 0%. Now, when the button is pressed, wheel will spin at 100% power forward, and when released – 0% power. That’s what we wanted.
It is a bit different with the right side wheel motor. We need to spin it backwards in order to move the whole robot forward. So when we press the button, it should be -100% and when we release the button – 0%.
To do so, set a “Range” slider accordingly and enable “Inverted” mode, to swap used slider points. When the button is pressed, left slider point at -100% will spin the wheel backwards and releasing it will select the right slider point at 0%, which stops the motor.
After that, repeat the same steps for all buttons and set functions “Back“, “Right” and “Left” accordingly.
Now get back to your Model view (don’t forget to select play) and try driving your robot. All buttons should make the motors spin correctly and robot should move as expected.
If motor spins incorrectly, simply go to faulty button and adjust configuration for that motor.
If two buttons are pressed at the same time, their values for motor are combined.
Now the only thing left is Servo motor.
Edit “Flip” button and here we have the same configuration. What is different here, is that Servo motor spins to a certain degree (from 0° to 180°). In this case “Range” values represent Servo position degree: -100% – 0°; 0% – 90°; 100% – 180°.
Adjust the slider to set the Servo motor minimum and maximum spinning angles. Each robot needs a different adjustment of angles.
In this example, if we press the “Flip” button, Servo motor spins to 167° (50%), and when released – 56° (-50%).
Click “Inverted” if swapped movement is required.
And it’s done! Your robot is ready to play!