---
# System prepended metadata

title: Overlay Bot Important Parameters to Tune

---

1. Angles in lateral shift if the need arises. Look for (orientation_msg->pose.orientation.z) inside if statements.
2. Timers in the behavior tree. There's a 50 second timer at the end of main3.cpp to make sure lateral shift execution is over before restarting the tree.
3. Go to catkin_ws. Source. roslaunch control_logic control_logic.launch. Publish 1 to /navigation_control to start. 
4. Other tuneable parameters in behavior tree are Reduce and Increase LAC. They need to be adjusted with the probe.
5. Set CheckZValuePositive60 accordingly with the camera angle. Use rostopic echo /imu/angles and check the y parameter. Add or reduce angles from current between 0 and 360.
6. If the bot does not stop at 60 or -60, might need to increase the range of angles from 10 to 15 or 20 or run it at a reduced speed or reduce the sleep for timer to 1 or 2 seconds at the end of the while loop in main method. A debugging method to check is manually getting it to positive 60 and echoing /skid_steer/cmd_vel to see the delay of publishing 0 to the topic.
7. Verify how AI model behaves by opening rviz. Changes might need to be made after confirming it's behavior.
8. To stop auto mode: rosnode kill behavior_tree_node, publish 0 to /navigation_control, call trigger srv stop()



Updates as of July 1:
1. Copy paste main3.cpp in control_logic. Scroll down to main method at the bottom of it replace /home/octobotics with /home/sensei or what the username is.
2. Clone https://github.com/octobotics/stop_auto build it and add it to sensei launch. It has std_srvs::Trigger calling it should do the job of killing BT at any time. The service is called /stop_auto
3. About positioning the bot in the shell because of lateral shift: 

                Towards Inside of the Shell (Crawler Shifts This Way)
                            ^
                            |
                            |
                            |
            Slider <----- Body----> ZED Camera
                            |
                            |
                            |
                            v
            Towards Outside of the shell aka the entrance
                
On publishing 1 to navigation_control the bot should move this way----------->
and not the opposite way

4. Echo topic/position_yaw when lateral shift is running. Check position x. If the lateral shift does not stop change:

if (orientationConditionMet && (ros::Time::now() < endTime) && (orientation_msg->pose.position.x <= -0.40)) at line 95 of lateral_shift main.cpp

To:

if (orientationConditionMet && (ros::Time::now() < endTime) && (std::abs(orientation_msg->pose.position.x) >= 0.40))


Updates as of July 3:
1. To run the entire sequence in infinite loop, copy the new main3.cpp inside src from https://github.com/octobotics/control_logic 
2. To launch control_logic, clone this repo to catkin_ws https://github.com/octobotics/bt_launcher, build it, add it to sensei launch. Call std_srv trigger /launch_script to launch it. Remember to chmod +x and chmod 777 the bash files.


Updates as of July 4:
1. Copy paste the new main3.cpp inside src from https://github.com/octobotics/control_logic inside update branch. There are two branches now. The new code will have two topics for setting angles, /positive_angle and /negative_angle both are std_msgs::Float32 data type. Publish values in the range of 0 to 360 to those topics. They are by default initialized to the 60 and 290 respectively.


Updates as of July 9:
    1. Made a new branch in https://github.com/octobotics/control_logic called overlay, copy paste the new main3.cpp inside src, it has a new topic called lateral_shift_stop_angle with the data type std_msgs/Float64. That topic is the angle you want the bot to stop at after finishing the sequence and then begin executing lateral shift. 