Full Version: NEW OSCtouch layout and CODE for the B-robot EVO2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
jjrobots23153 made a new TouchOSC (attached into a zip file) layout that contains a xy control instead of the two faders. He also added the battery fader and voltage readout.

Great job Cliff!
We will keep updating this thread ;-)
These instructions are for using TouchOSC app on an iPhone only.

I wanted to use a joystick to control the BROBOT. I decided to change the BROBOT layout in TouchOSC to use the xy control instead of the two faders. My objective was to make the change transparent so that it would not effect the current layouts or apps. Included in the attached zip file is the OSCxy.ini file that accomplishes that.

. Unzip the attached file to a temporary folder.
. Copy the OSCxy.ini file to the folder that contains the Adruino source files.
. Rename the current OSC.ini file to OSC.ini.sav
. Start up the Arduino IDE and compile and upload it to the Leonardo board.

You will have to also send the new layout (BROBOTxy.touchosc) to the TouchOSC app on your iPhone.

When in the TouchOSC app on your iPhone you need to change one of the options to make the new battery indicators to work as shown in the attached screen shots.

. Go to settings. (white dot in the top right of the screen)
. Choose Options
. Select Send Ping (/ping).
. Set the Delay to some ware between 20s and 30s.
. You also have to have the Touch Messages (/z) ON to have the control return to center when you lift your finger.

When you first start to use the xy control place your finger in the center of the box. This will center the xy bullseye.

I have to give credit to sasa999 for his battery layout and the clue to make it work was to send the ping option from the app.

The instructions for doing most of this is in the assembly instructions from the main webpage. Follow this link: https://www.jjrobots.com/b-robot-evo-2-assembly-guide/

For those that have more skills then I have you can make the xy control more sensitive by going into the TouchOSC editor and reducing the width and height of the xy box.

If you choose not to use this layout after installing these changes you can go back and use the original layout without having to change the code.

I hope you enjoy using the xy control.
If you just wanted to use the new battery indicator and keep the old layout using the faders you can download the layout below. But you will still have to download the OSCxy code from the previous posts and install that first and make the option changes
to the app also.

(10-03-2017 08:58 AM)jpedroc Wrote: [ -> ]jjrobots23153 made a new TouchOSC (attached into a zip file) layout that contains a xy control instead of the two faders. He also added the battery fader and voltage readout.

Great job Cliff!
We will keep updating this thread ;-)

If you are using a different battery then the battery holder that came with the kit or a 9 volt battery you will have to make a change to the code to the OSCxy.ini file. At the top of the file are these instructions :
//   Battery voltage per battery Alkiline = 1.5, NiCad/NiMH = 1.25, Lipo = 4.2
// If using other then the 6 alkaline batterys in the battery holder or a 9 volt battery
// comment out the next line and uncomment the line for the battery you are using.
float Battery_Normal_Voltage = 9.0;    // Value of 6 alkaline batteries or 9 volt battery
//float Battery_Normal_Voltage = 7.5;     // Value of 6 NiCad/NiMh batteries
//float Battery_Normal_Voltage = 12.6;    // Value of a 3 call lipo battery
//float Battery_Normal_Voltage = 8.4;     // Value of a 2 call lipo battery
The "BROBOTxy.zip" does not contain the .ini file unfortunately.

Oh oh... there is a different zip "OSCxy.zip" and that contains the file but it is an ".ino" file not an .ini... I think I'm on the right track now... sorry for the noise.
When I use the joystick the robot stops responding and immediately falls down. It won't listen anymore. What could cause that? I've tried it several times but only intermittently does it listen to the joystick for maybe a few seconds then it shuts down.

Note 1: I'm using the DEVIA board, probably most recent version - the all-in-one design built in USA but designed in Europe.

Note 2: The code in GitHub does not compile for this board. Contro.ino uses "ISR()" interrupt redefinitions which is not aloud.

Note 3: I'm using the Arduino code in the "BROBOT_EVO2_23_M0.zip" linked in these forums but not on GitHub.

Note 3: I replaced the Control code with the special xy code.
It seems that "Touch Messages" (/z) when that is turned ON is when it all shuts down. But I thought that was so that controls return to center? Anyone have this incompatibility with "Touch Messages" ?
It's failing in void OSC_MsgSend()

I'm outputting line-by-line serial println statements inside that call and it fails at line:
c[msgSize - 4] = u.Buff[3];

I'll paste the method here in it's entirety - I haven't changed anything other than adding print statements. I don't understand what it is supposed to be doing... but I know the last thing I see in the serial monitor is "Mark 2"

void OSC_MsgSend(char *c, unsigned char msgSize, float p)
SerialUSB.println("Starting MsgSend");
uint8_t i;
union {
unsigned char Buff[4];
float d;
} u;

SerialUSB.println("Mark 1");
// We copy the param in the last 4 bytes
u.d = p;
SerialUSB.println("Mark 2");
c[msgSize - 4] = u.Buff[3];
SerialUSB.println("Mark 3");
c[msgSize - 3] = u.Buff[2];
SerialUSB.println("Mark 4");
c[msgSize - 2] = u.Buff[1];
SerialUSB.println("Mark 5");
c[msgSize - 1] = u.Buff[0];
SerialUSB.println("Mark 6");
for (i = 0; i < msgSize; i++)
SerialUSB.println("attempting MsgSend");
SerialUSB.println("Did not fail to MsgSend");
Aha! I figured out the issue but I have no idea how it ever could have been working.

We were creating a string constant, passing it in as a pointer, casting as an array and "modifying it" - of course it should choke.

I changed the code to pass in a char array and modify that array.
My family worked on this together. Attached is a zip file containing:

1) Modified Arduino files - this fixes the bugs that prevent compilation and also prevent using OSCTouch app with the new DEVIA boards. No more segmentation faults from C code that modified protected memory. The files also support the joystick controller (xy). There is also a new toggle called "Sentry" that performs a routine that causes the robot to scout out a perimeter.

2) New Dual Layout for TouchOSC - this has three panes. The first pane is the standard dual sliders. The second pane has Cliff's joystick control plus the "Sentry" button. The third pane is the PID tweaker sliders.
Pages: 1 2
Reference URL's