This is a python project running on a Jetson Nano doing computer vision and localization for FIRST Robotics Competition 2020.
The project uses three cameras:
- A Microsoft LifeCam HD-3000 to detect the reflective tape on the shooting target
- An Intel Realsense D435 for ball detection using RGBD data
- An Intel Realsense T265 for visual odometry
- OpenCV 4.2.0
- Intel Realsense SDK (with pyrealsense2)
- pynetworktables
- robotpy-cscore (optional, for CameraServer video streaming)
- all coordinate system are converted to WPI format, x+ forward of robot, y+ leftward of robot, righthand rule (0 deg forward, turn left increase theta)
- the poses of RGB camera and t265 with respect to robot need to be set in PoseTracker
pose_good: whether t265 is workingtarget_good: whether RGB camera workingball_good: whether D435 is workingclient_time: time update indicating that nano is alive and connected
robot_[xyt]: the 2d pose with respect to t265's starting posefield_calibration_start: set this flag to true if the robot is static and facing the correct target, usually at the start of the game. After recognizing the flag, Nano will set this to false.field_calibration_good: whether the field_calibration is done. This should be set to false after Nano disconnects.field_[xyt]: the 2d pose of the robot with respect to the field, this is only usable after field_calibrationerror_xy/error_theta: whentarget_foundis true, these two fields show the error between the field pose return by camera and by t265 using last field calibration. This is not lag-compensated.encoder_v: this is the input for wheel odometry data, which needs to be set up in config
target_found: whether the target is found by the RGB cameratarget_field_theta: in field coordinate, the angle the robot should turn to have RGb camera align with the targettarget_dis: the distance from camera to target in 2d plane.target_relative_dir_left: in case t265 disconnects but RGB camera works, this shows how many degrees left the robot should turn to face the targetCV/camera_{xyztpr}: the raw camera x, y, z, yaw, pitch, roll data in world from solvepnp
ball_found:
ball_dis:
ball_to_left:
ball_field_theta:
v4l2-ctl -d /dev/video0 --list-ctrls
v4l2-ctl -d /dev/video0 -c auto_exposure=1
http://www.peterklemperer.com/blog/2018/02/10/manual-exposure-control-of-opencv-video/
ls -ltrh /dev/video*