Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ESP32 Port of B-Robot_EVO2 Code
06-25-2018, 12:30 PM (This post was last modified: 06-25-2018 02:22 PM by viocudinti.)
Post: #41
RE: ESP32 Port of B-Robot_EVO2 Code
Hello ghmartin77,

Your kung fu is strong! Yes, the locks were indeed causing the meditation errors. Now the robot is no longer continuously rebooting but it actually works for a while.
It's still not fully stable though on latest master branch. After a few minutes it stops reading the gyroscope (angle_adjusted gets stuck on last value, not sure about the exact reason). It sometimes happens out of the blue, sometimes when connecting to it by wifi.

Edit: I have tried the Stickbreaker branch/fork using the code changes that dasMopo proposed and it's much better now. Still some problems after half an hour or so. I'm still investigating those, maybe some bad contacts.
http://forums.jjrobots.com/thread-1399-p...ml#pid3670

Thanks,
Viorel

(06-23-2018 02:37 PM)ghmartin77 Wrote:  Hi Viorel,

Happy to hear you've fun with the ported code Smile
Well, there's a bug in my code as well that did not appear with the old esp32 platform version mentioned so I didn't update my repository, but maybe this one kicks in now, while I2C might(!) work today (haven't tried). I'm messing around with proper locking in Timers.cpp, lines 29 and 46. Returning this way from the methods will not release the locks properly and the code is killed sooner or later by the WDT (Watch Dog Timer). Your error is pointing towards this. You can fix it by changing the code by modifying the condition of the if statement from "== 0" to "!=0", removing the return statement and putting everything but the portExit... lines into {} brackets.

Maybe this helps...

If I've got some more sparetime I will add the fix to Github...

Good luck! Please let me know if it does the trick. Would mean I2C is fixed again in esp32 platform...

Best,
ghmartin77
Find all posts by this user
Quote this message in a reply
06-26-2018, 02:08 PM
Post: #42
RE: ESP32 Port of B-Robot_EVO2 Code
yes it work, but need to add 1us delay on Step signal (fot DRV8825 - 2us).

void delay_1us(){
for (uint8_t k = 0; k < 20; k++){
__asm__ __volatile__ (
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop" "\n\t"
"nop");
}
}

extern "C" {

portMUX_TYPE muxer1 = portMUX_INITIALIZER_UNLOCKED;
portMUX_TYPE muxer2 = portMUX_INITIALIZER_UNLOCKED;

void IRAM_ATTR timer1ISR() {
portENTER_CRITICAL_ISR(&muxer1);

if (dir_M1 != 0) {// If we are not moving we dont generate a pulse
// return;
// We generate 1us STEP pulse
digitalWrite(PIN_MOTOR1_STEP, HIGH);
delay_1us();

if (dir_M1 > 0)
steps1--;
else
steps1++;

digitalWrite(PIN_MOTOR1_STEP, LOW);
}
portEXIT_CRITICAL_ISR(&muxer1);
}
void IRAM_ATTR timer2ISR() {
portENTER_CRITICAL_ISR(&muxer2);

if (dir_M2 != 0){ // If we are not moving we dont generate a pulse
// return;
// We generate 1us STEP pulse
digitalWrite(PIN_MOTOR2_STEP, HIGH);
delay_1us();

if (dir_M2 > 0)
steps2--;
else
steps2++;

digitalWrite(PIN_MOTOR2_STEP, LOW);
}
portEXIT_CRITICAL_ISR(&muxer2);
}
}
Find all posts by this user
Quote this message in a reply
12-19-2018, 11:28 AM
Post: #43
RE: ESP32 Port of B-Robot_EVO2 Code
OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

rolfz programming pic, avr, Arm and ESP8266, RPI and now ESP32 , building planes drones, robots and plenty other stuff.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-19-2018, 12:42 PM
Post: #44
RE: ESP32 Port of B-Robot_EVO2 Code
Doesn't make sense for me as well. Something starting with $ seems not to be a valid OSC message with regards to the 1.0 spec I found.
However, it's interpreted by the app showing angle and battery status properly. So maybe kind of an "extension"? Smile
Find all posts by this user
Quote this message in a reply
12-19-2018, 06:38 PM
Post: #45
RE: ESP32 Port of B-Robot_EVO2 Code
Thank you for the comment, I wonder what touchosc file corresponds to the $ file, do you have a link ?

rolfz programming pic, avr, Arm and ESP8266, RPI and now ESP32 , building planes drones, robots and plenty other stuff.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-19-2018, 10:36 PM (This post was last modified: 12-19-2018 11:33 PM by mmormota.)
Post: #46
RE: ESP32 Port of B-Robot_EVO2 Code
I just built the robot, thank you for porting the code to esp32.
https://vimeo.com/307303086
I have a few questions:
- how and where to connect the battery voltage for measurement?
- the 2nd servo in the app is working? has it output on the esp32?
- I am about to add Leds, is it possible to modify the Android app?
- The robot runs and balances very well, however the motors are rather weak. If the torque exceeds a small limit, the driver somehow switches off, it beeps but not turning the motor. If the direction alters, it drives again( I mean I tilt manually the robot to the other side). The torque limit is not really depends on the current limit. My controllers are DRV8825, the stepper is a 0.9 degree type, 1/8 microstep, 3s Lipo. The robot can't handle small obstacles, and I think it's because of the weak motors. Maybe I need better motors (is there a preferred type)? There are videos outside with difficult terrain, so there must be a solution.
   
Find all posts by this user
Quote this message in a reply
12-20-2018, 01:10 PM
Post: #47
RE: ESP32 Port of B-Robot_EVO2 Code
(12-19-2018 11:28 AM)rolfz Wrote:  OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

$t simply means the start of the telemetry packet. It is a header identifier. Does not really means nothing
B will send the Battery value

Hope this helps!
Visit this user's website Find all posts by this user
Quote this message in a reply
12-20-2018, 01:26 PM (This post was last modified: 12-20-2018 01:30 PM by rolfz.)
Post: #48
RE: ESP32 Port of B-Robot_EVO2 Code
(12-20-2018 01:10 PM)JJrobots JP Wrote:  
(12-19-2018 11:28 AM)rolfz Wrote:  OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

$t simply means the start of the telemetry packet. It is a header identifier. Does not really means nothing
B will send the Battery value

Hope this helps!

(12-20-2018 01:26 PM)rolfz Wrote:  
(12-20-2018 01:10 PM)JJrobots JP Wrote:  
(12-19-2018 11:28 AM)rolfz Wrote:  OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

$t simply means the start of the telemetry packet. It is a header identifier. Does not really means nothing
B will send the Battery value

Hope this helps!

Thank you, sorry to ask again, $tB and $tA are telemetry packs from Arduino/ESP TOUCHOSC library to TOUCHOSC on iPhone/Smartphone and can be used for WIFI communication ? is there a documentation somewhere about it ?

rolfz programming pic, avr, Arm and ESP8266, RPI and now ESP32 , building planes drones, robots and plenty other stuff.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2018, 10:10 AM
Post: #49
RE: ESP32 Port of B-Robot_EVO2 Code
(12-20-2018 01:26 PM)rolfz Wrote:  
(12-20-2018 01:10 PM)JJrobots JP Wrote:  
(12-19-2018 11:28 AM)rolfz Wrote:  OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

$t simply means the start of the telemetry packet. It is a header identifier. Does not really means nothing
B will send the Battery value

Hope this helps!

(12-20-2018 01:26 PM)rolfz Wrote:  
(12-20-2018 01:10 PM)JJrobots JP Wrote:  
(12-19-2018 11:28 AM)rolfz Wrote:  OSC strange code
sprintf(auxS, "$tB,%+04d", BatteryValue);
OSC_MsgSend(auxS, 25);

Does anyone understand this $t commands in the EVO2 code.
I know a little about OSC but this kind of syntax is not covered in the OSC doc.

Would be very usefull if someone could explain it to me.
(Using the TouchOSC app on my iPhone), it normally worked with this kind of syntax
OSC_MsgSend("/$tB\0\0\0\0,f\0\0\0\0\0", 15, (float)BatteryValue);

$t simply means the start of the telemetry packet. It is a header identifier. Does not really means nothing
B will send the Battery value

Hope this helps!

Thank you, sorry to ask again, $tB and $tA are telemetry packs from Arduino/ESP TOUCHOSC library to TOUCHOSC on iPhone/Smartphone and can be used for WIFI communication ? is there a documentation somewhere about it ?
in this case B represents "battery", this character "B" is sent attached to a header "$t" as a unique identifier to the OSC app so it will not confused with any other value. The same for $tA for the "angle". They are the two values sent back to the OSC APP as telemetry. The OSC app uses MIDI commands. You can find more info here: https://www.midi.org/specification
Visit this user's website Find all posts by this user
Quote this message in a reply
03-03-2019, 05:12 PM
Post: #50
RE: ESP32 Port of B-Robot_EVO2 Code
as this seems to be "the" esp32 thread.... Smile
anyone designed a pcb for esp-wroom32, 2x motordriver, 2x stepdown (1x 5v/servo, 1x 3.3v/esp)?

just thinking about making one - adding ws2812 led-strip connector and spectrum-receiver connector (as alternative to wifi/app control).

but before starting from scratch (= the schematics available for the arduino/atmega version) i'm curious if anyone did it / want's to share...?

Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)