I was wondering if it was possible to change the robot's default pose when it first starts up. For context, I am working with the robot's bluetooth connection and every time the robot disconnects and reconnects, if it is not in the rest position it slams into the ground quickly. Is there any way to change this to where the robot initially sits that way the frame is not damaged? I tried looking into the OpenCat code, but I cannot find the place where the initial position is set. Would simplify adding a sit command to the queue at beginning of the initializing work? Thank you!
top of page
bottom of page
In the initRobot() function of OpenCat.h, there is this code:
#ifdef GYRO_PIN // read_IMU(); //ypr is slow when starting up. leave enough time between IMU initialization and this reading tQueue->addTask((exceptions) ? T_CALIBRATE : T_REST, ""); #endif #if defined DOUBLE_LIGHT || defined DOUBLE_TOUCH || defined DOUBLE_INFRARED_DISTANCE || defined ULTRASONIC if (moduleActivatedQfunction(EXTENSION_DOUBLE_LIGHT) || moduleActivatedQfunction(EXTENSION_DOUBLE_LIGHT) || moduleActivatedQfunction(EXTENSION_DOUBLE_LIGHT)) { tQueue->addTask(T_SKILL, "sit", 500); } else { tQueue->addTask(T_REST, ""); }
The possible "default" initial tokens are therefore T_CALIBRATE, T_REST, and T_SKILL with "sit", depending on what features are enabled (and, for the case of the GYRO_PIN macro directive, the presence of exceptions, specifically, is the robot on its side or flipped over?)
The default for most conditions is T_REST. To your point, you could try adding the following statement before that block, if you want to first have the robot "sit" before those checks:
tQueue->addTask('k', "sit");
Note that I am using the token value 'k' rather than the equivalent macro directive T_SKILL. Strictly speaking, I think use of the macro directive is preferred (in case the character used changes from 'k' to something else) but, for many purposes, I just use the token value that underlies the macro directive.
Hope that helps!