Skip to content

Quick test with USB cam

koide3 edited this page Aug 20, 2021 · 7 revisions

Environment

Tested on

  • Jetson Xavier (Jetpack 4.5.1) with ROS melodic
  • Ubuntu 20.04 with CUDA 11.2 (CUDA >= 10.2 required)

Setup Camera Info

Create ~/.ros/camera_info/top_front_camera.yaml and write the following:

image_width: 1920
image_height: 1080
camera_name: top_front_camera
camera_matrix:
  rows: 3
  cols: 3
  data: [698.7720089327581, 0, 948.6984995929716, 0, 694.4581011591363, 616.7070850305417, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.01537233838335354, -0.01014287588454407, 0.0002858743531724768, -0.0007284003454982942, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [637.4007568359375, 0, 938.8160461941588, 0, 0, 683.8585815429688, 619.8708349350127, 0, 0, 0, 1, 0]

Note: Although the module would somehow work, it's better to replace the parameters with that of your camera, of course.

Docker image

Jetpack

sudo docker pull koide3/monocular_person_following:jp45

Desktop

sudo docker pull koide3/monocular_person_following:noetic

Note: You can build the image from source instead, but the build may take a few hours on a Jetson.

Launch

Start roscore

roscore

Visualization:

cd /tmp
wget https://github.com/koide3/monocular_person_following/raw/master/rviz/monocular_person_following.rviz
rviz -d monocular_person_following.rviz

Jetpack

Launch usb_cam and tf_publishers:

sudo docker run -it --rm \
                --net host \
                --device /dev/video0:/dev/video0 \
                -v $(realpath ~/.ros/camera_info):/root/.ros/camera_info \
                koide3/monocular_person_following:jp45 \
                roslaunch monocular_person_following start_robot.launch webcam:=true publish_dummy_frames:=true camera_xyz:="0 0 0.9" camera_rpy:="0 0 0"

Launch tf_openpose and monocular_person_following:

sudo docker run -it --rm \
                --net host \
                --gpus all \
                koide3/monocular_person_following:jp45 \
                roslaunch monocular_person_following jetson_person_following.launch camera_name:=/top_front_camera/qhd

Desktop

Launch usb_cam and tf_publishers:

sudo docker run -it --rm \
                --net host \
                --device /dev/video0:/dev/video0 \
                -v $(realpath ~/.ros/camera_info):/root/.ros/camera_info \
                koide3/monocular_person_following:noetic \
                roslaunch monocular_person_following start_robot.launch webcam:=true publish_dummy_frames:=true camera_xyz:="0 0 0.9" camera_rpy:="0 0 0"

Launch tf_openpose and monocular_person_following:

sudo docker run -it --rm \
                --net host \
                --gpus all \
                koide3/monocular_person_following:noetic \
                roslaunch monocular_person_following jetson_person_following.launch camera_name:=/top_front_camera/qhd allow_growth:=true

Example image

Screenshot_20210820_182655 Video

You can become the target by raising the right hand