Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with sound and drive commands #2

Open
BaChant opened this issue Nov 17, 2020 · 3 comments
Open

Problems with sound and drive commands #2

BaChant opened this issue Nov 17, 2020 · 3 comments

Comments

@BaChant
Copy link

BaChant commented Nov 17, 2020

I was using your libary for create2 and found it very usefull. Thanks!
But I was having some errors and after sending commands via Arduino to the robot directly, they disappeared. So I assume it's a bug in the libary code, even though I couldn't locate it.
The problems occur only sometimes. Without changing anything in the code or the setup, they just happen.

  1. Roomba doesn´t drive straight but slightly turns to the left. Next time I turn it on, it drives perfectly straight as I wish. Same code, nothing changed.
  2. Sometimes it takes longer for roomba to make a full turn.
  3. Sometimes it plays the programmed songs nicely and the next time a note freezes while playing. Than the song stops and the next song isn’t played at all. (maybe a problem in the calculation of the songnotes?)

Until now I didn't ran into these problems when sending the commands directly.
(I was using serial with your libary now I'm using soft serial, maybe this could be part of the problem as well?)

I posted the problem together with my code and a video on stackexchange:
https://robotics.stackexchange.com/questions/21128/irobot-create-2-random-changes-in-driving-speed

I hope this is the right place to post comments and field reports - I'm new to github.

Best
Sebastian

@DomAmato
Copy link
Member

DomAmato commented Dec 7, 2020

Thanks for reaching out, been awhile since I touched this code but I can review the technical document again. Thats interesting that it works with normal serial but the software based serial seems to drop commands now and again. I will try to get to this some time this month :)

@BaChant
Copy link
Author

BaChant commented Mar 1, 2021

Hey,

I finished the roomba-project I was working on. I found out, that the weird behavior (not driving straight, taking different amounts of time for full turns) is not related to your code. It occurs also without your libary. I think it`s something in the basic programming or hardware of the roomba.
The only thing that really seems to be related to your libary is the playing of songs. After I made a code from scratch they played nicely and never failed to play.
Just as a final report :)

@SJansenLMD
Copy link

Thanks for the library. It was a good start for me.

As for the code to play songs: The definition of notes is not correct. The octave number for the notes is wrong. That makes songs play like the poor roomba is pretty drunk.

enum notes{
N_G1 = 31,
N_G1S = 32,
N_A1 = 33,
N_A1S = 34,
N_B1 = 35,
N_C1 = 36, //should be C2
N_C1S = 37, //should be C2S
N_D1 = 38, //should be D2
N_D1S = 39, //should be D2S
N_E1 = 40, //should be E2
N_F1 = 41, //should be F2
N_F1S = 42, //should be F2S
N_G2 = 43,
N_G2S = 44,
N_A2 = 45,
N_A2S = 46,
*
*
*

And so on. I know, musicians don't seem to know how to count. See for example: https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies
Or: https://www.google.com/search?q=midi+notes+numbers&rlz=1C1GCEA_enNL902NL902&oq=mid&aqs=chrome.0.69i59j69i57j69i65l3j69i61j69i60l2.2279j0j7&sourceid=chrome&ie=UTF-8

If the constant delay of 100ms used to calculate the length of the song is changed it seems to solve some songs not to be played. It's especially apparant when using a few long notes. Maybe the length of the notes isn't exact enough? Resulting in a mismatch in timing between Roomba and Microcontroller? It all depends on timers and dividers used in hardware I presume?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants