GoPiGo i2c low level command protocol


#1

Hi,

I’m looking for a document describing the low level command protocol I need to use to set and get GoPiGo values please (fields of frames for questions and answers, and so on).

Where could I get a such document please ?

I only found a few informations in firmware ino file on GitHub like this :

//Command list received from the Raspberry Pi
#define fwd_cmd         119     //Move forward with PID
#define motor_fwd_cmd   105     //Move forward without PID
#define bwd_cmd         115     //Move back with PID
#define motor_bwd_cmd   107     //Move back without PID
#define left_cmd        97      //Turn Left by turning off one motor
#define left_rot_cmd    98      //Rotate left by running both motors is opposite direction
#define right_cmd       100     //Turn Right by turning off one motor
#define right_rot_cmd   110     //Rotate Right by running both motors is opposite direction
#define stop_cmd        120     //Stop the GoPiGo
#define inc_speed_cmd   116     //Increase the speed by 10
#define dec_speed_cmd   103     //Decrease the speed by 10
#define m1_cmd          111     //Control motor1
#define m2_cmd          112     //Control motor2
# define read_motor_speed_cmd 114 //Read the motor speeds
...

Thank you,
regards,
JL


#2

Hi @jeanlouis.calmon,

Could you tell us what you are trying to achieve by working with the low-level stuff?
Depending on what’s your target, we can better understand how we can help you.


And, regarding the document which explains the low-level protocol, unfortunately, I don’t think we have one.


Thank you!


#3

Hi @RobertLucian,

I am software teacher, I bought some GoPiGos to use with my students.
I would like them to use I2C commands to drive the board and read encoder & sensor values.
I would like them to create C++ class for GoPiGo.

I saw gopigo c and h files, but I wouldn’t waste time to decode program to retreive low level commands.

Do you think Dexter would give us this information ?


#4

Maybe creating a C++ interface is an easy assignment, if change the code in:


to C++ class called GoPiGo() gopigo.cpp ?

(and even easier if someone has Microsoft Visual Studio to look at the C# library code there…)

Reverse engineer gopigo.c and you can throw away all the high level funcs and just send i2c reads and writes,

I started out my software career (41 years ago) wanting to understand everything to the finest degree. I failed to learn to trust and leverage other peoples code. I spent years re-inventing everything and suffering from NIH syndrome. A balance between science, engineering, and business is important. At the science level we understand everything. At the engineering level we understand to apply the science. It turned out there is a level they didn’t teach me in school - how to apply the science to meet the time, resources, quality pyramid.

Now I understand how to move the servo and get ultrasonic readings, both of which have out-of-the-box solutions. What I cannot remember is the geometry to compute if {(r,theta), (r,theta), (r,theta)) are with-in limit in a straight line - meaning I’m looking at a wall, and to compute if they form a 90 degree angle to know that I am looking at a corner. Those would also be c/c++ methods that the community could use.

I’d even be willing to give two $20 gift DI gift certificates for those methods in Python.

Good luck


#5

Hi @jeanlouis.calmon,

I’ve been looking over our GoPiGo repository.
It seems there are just basic functions which use the I2C protocol.


In order to be able to replicate / explain the I2C protocol, you only need to have a look at the gopigo.py and at the firmware of the GoPiGo.

So, what we have is not that complex.
The code can be understood just by reading it.


Please tells us if there’re things still unclear or if you need assistance at something.

Thank you!