---
# System prepended metadata

title: 'VIN: MONO '

---




r**RRC: VINS DOCUMENTATION**

first open up in grub menu and select 3rd option .150
then run docker images
`docker run -i -t realsense:V2`

# This script automatically mounts all detected video devices
```
DEVICES=""
for dev in $(ls /dev/video* 2>/dev/null); do
  DEVICES+="--device=$dev "
done
```
jdnee
---


 

yuvraj@UV:~$
`xhost +local:root`


```
docker run -it --rm \
  --device=/dev/video0 \
  --device=/dev/video1 \
  --device=/dev/video2 \
  --device=/dev/bus/usb \
  --privileged \
  -v /dev:/dev \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -e DISPLAY=$DISPLAY \
  guptuv/launchfie:prblm
```
**MOunting command**
```
docker run -it --rm \
  --device=/dev/video0 \
  --device=/dev/video1 \
  --device=/dev/video2 \
  --device=/dev/bus/usb \
  --privileged \
  -v /dev:/dev \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v /home/yuvraj/Downloads:/root/Downloads \
  -e DISPLAY=$DISPLAY \
  guptuv/launchfie:prblm
```

then run 
```
realsense-viewer
```
for running same container in diff terminal

`docker exec -it [CONTAINER_ID] bash`

flags these
same container id in diferent terminal

```
docker exec -it \
  -e DISPLAY=$DISPLAY \
  [ID container] bash
```

```
docker exec -it \
  --privileged \
  -v /dev:/dev \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -e DISPLAY=$DISPLAY \
  [Container_ID]
```
<!-- docker run -it --rm \
  --device=/dev/video0 \
  --device=/dev/video1 \
  --device=/dev/video2 \
  --device=/dev/bus/usb \
  --privileged \
  -v /dev:/dev \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -e DISPLAY=$DISPLAY \
  realsense:v3 -->


Docker COMMIT'
```

 docker commit c3f279d17e0a  svend:version3
```
for launching realsense in rviz

`roslaunch realsense2_camera demo_pointcloud.launch `


Kalibr


```
1.   /root/catkin_ws/src:/opt/ros/noetic/share
2.  /root/librealsense/unit-tests/resources/single_depth_color_640x480.bag
3.  /root/catkin_ws/src/tartancalib/camera_calib.yaml
4.  /root/kalibr_output
5. root@5d6e09ac9700:~/catkin_ws/src/tartancalib# rosbag info /root/librealsense/unit-tests/resources/single_depth_color_640x480.bag | grep "/image"
              /device_0/sensor_0/Depth_0/image/data                              2 msgs    : sensor_msgs/Image        
              /device_0/sensor_0/Depth_0/image/metadata                         36 msgs    : diagnostic_msgs/KeyValue 
              /device_0/sensor_1/Color_0/image/data                              1 msg     : sensor_msgs/Image        
              /device_0/sensor_1/Color_0/image/metadata                         22 msgs    : diagnostic_msgs/KeyValue
```



command 

```
source /root/catkin_ws/devel/setup.bash && \
rosrun kalibr tartan_calibrate \
    --bag /data/bag.bag \
    --target /config/target.yaml \
    --topics /device_0/sensor_1/Color_0/image/data /device_0/sensor_0/Depth_0/image/data \
    --models omni-radtan omni-radtan \
    --min-init-corners-autocomplete 29 \
    --min-tag-size-autocomplete 2 \
    --correction-threshold 10.1 \
    --dont-show-report \
    --save_dir /output
```

```
source /root/catkin_ws/devel/setup.bash && \
rosrun kalibr tartan_calibrate \
    --bag /root/librealsense/unit-tests/resources/single_depth_color_640x480.bag \
    --target /root/catkin_ws/src/tartancalib/camera_calib.yaml \
    --topics /device_0/sensor_1/Color_0/image/data /device_0/sensor_0/Depth_0/image/data \
    --models omni-radtan omni-radtan \
    --min-init-corners-autocomplete 29 \
    --min-tag-size-autocomplete 2 \
    --correction-threshold 10.1 \
    --dont-show-report \
    --save_dir /output
```



camer on roslaunch ...
rostopics list
pick up image topic
rosbag recor(imagr topic mname)

run rviz in another file


```
rosrun kalibr tartan_calibrate \
    --bag /root/2025-05-19-11-03-56.bag \
    --target /root/catkin_ws/src/tartancalib/camera_calib.yaml \
    --topics /device_0/sensor_1/Color_0/image/data /device_0/sensor_0/Depth_0/image/data \
    --models omni-radtan omni-radtan \
    --min-init-corners-autocomplete 29 \
    --min-tag-size-autocomplete 2 \
    --correction-threshold 10.1 \
    --dont-show-report \
    --save_dir /output
```


rosrun kalibr tartan_calibrate \
    --bag /root/2025-05-19-11-47-01.bag 
    --target /root/catkin_ws/src/tartancalib/camera_calib.yaml \
    --topics /camera/color/image_raw\
    --models omni-radtan omni-radtan \
    --min-init-corners-autocomplete 29 \
    --min-tag-size-autocomplete 2 \
    --correction-threshold 10.1 \
    --dont-show-report \
    --save_dir /output


```
 rosrun kalibr tartan_calibrate --bag /2025-05-19-13-39-06.bag --target /catkin_ws/src/tartancalib/camera_calib.yaml --topics /camera/color/image_raw --min-init-corners-autocomplete 29 --min-tag-size-autocomplete 2 --correction-threshold 10.1 --models pinhole-fov --dont-show-report --save_dir /kalibr_outputs --verbose

```
    
    cd
    

https://youtu.be/rBT5O5TEOV4
Great help from this video and channel

Hey i ran this command 
```
cd ~/catkin_ws/src
git clone https://github.com/ethz-asl/schweizer_messer.git
```
```
cd ~/catkin_ws
catkin_make
source devel/setup.bash
```
now i wanna remove it


```
rm -rf ~/catkin_ws/src/schweizer_messer

cd ~/catkin_ws
catkin_make
```


`source devel/setup.bash`

also while capturing ensure the sm model is installed and while calibrating it's removed



Results"
Summary of What Went Right
676 images out of 837 were successfully used for corner extraction.

The target was detected consistently, and a meaningful number of camera error terms were added.

The optimization initialized, and multiple iterations of Levenberg-Marquardt ran with a decent reduction in cost (J dropped from ~59,000 to ~7,100


it worked for pinhole-radtan camera model


search for pinhole radtan and otheres diff

catkin_make then  
docker hub push
done

with software part of https://github.com/HKUST-Aerial-Robotics/VINS-Mono
only diff is of vins mono on a radially distored camera and a tangentiallty distorted camera we r working on then paper inplementation


for usb camera 
first install get it from gpt

then make up a new launch file for it 
gpt it

 then 
 
` rosrun kalibr tartan_calibrate --bag /2025-05-20-11-04-36.bag --target /catkin_ws/src/tartancalib/camera_calib.yaml --topics /image_view/output --min-init-corners-autocomplete 29 --min-tag-size-autocomplete 2 --correction-threshold 10.1 --models pinhole-radtan --dont-show-report --save_dir /usb_camera_outputs --verbose --plot`


`docker exec -it   -e DISPLAY=$DISPLAY   5f2e238b6a53 bash`



REALSENSE IMU ANSD CAMERA FROM 

`roslaunch realsense2_camera rs_camera.launch   enable_color:=true   enable_gyro:=true   enable_accel:=true   unite_imu_method:=linear_interpolation   enable_sync:=true  # Critical for time-synced IMU+camera data`

** INFRA cam on **
`roslaunch realsense2_camera rs_camera.launch enable_infra1:=true enable_infra2:=true enable_gyro:=true enable_accel:=true unite_imu_method:=linear_interpolation`

    sudo apt-get install ros-noetic-cv-bridge ros-YOUR_DISTRO-tf ros-YOUR_DISTRO-message-filters ros-YOUR_DISTRO-image-transport
    
    
    remember by now we have make that as comment statement in roslaucnh of coment sections of realsense viewer so it wont'open
    
    
    
✅ Option 1: Copy a File to a Running Docker Container
If the container is already running and you want to copy a file into it:

bash
Copy
Edit
`docker cp /path/to/your/file.txt container_name_or_id:/path/in/container/file.txt`    

CERES INSTALLATION first do prequisite of vins mono

# ✅ Installing Ceres Solver 1.14.0 on Ubuntu (Beginner-Friendly Guide)

This guide helps you install Ceres Solver 1.14.0 on Ubuntu and verify the installation step by step, even if you're a complete beginner.

---

## 🧰 Prerequisites

```
Open a terminal and install the required dependencies:

```bash
sudo apt update
sudo apt install -y cmake libgoogle-glog-dev libgflags-dev libatlas-base-dev libsuitesparse-dev


cd ~
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
git checkout 1.14.0
mkdir build && cd build
cmake ..
make -j4


sudo make install

```
 ****REMEMBER to b in home not in root gpt gives of root
Then do

```
cd catkin_ws
catkin_make_isolated   # isolated as catkin_make failed and listed this and an option
```

`source catkin_ws/devel_isolated/setup.bash`


check by 
`ls catkin_ws/devel_isolated/vins_estimator/lib/vins_estimator/`

```
ls -l /catkin_ws/devel/lib/feature_tracker/
ls -l /catkin_ws/devel/lib/vins_estimator/
ls -l /catkin_ws/devel/lib/pose_graph/
```


**Step 1: Commit the Running Container to a New Image**
Find your container ID:

bash
`docker ps`
(Note the CONTAINER ID of your running container.)

Commit changes to a new Docker image:

bash
docker commit [CONTAINER_ID] your-dockerhub-username/new-image-name:tag
Example:

bash
`docker commit abc123 yourusername/my-custom-image:v1`
Step 2: Tag the Image (Optional, but Recommended)
If you didn’t tag it during commit, tag it now:

bash
docker tag [IMAGE_ID] your-dockerhub-username/new-image-name:tag
Example:

bash
`docker tag def456 yourusername/my-custom-image:latest`
Step 3: Log in to Docker Hub
bash
`docker login`
(Enter your Docker Hub username and password.)

**Step 4: Push the Image to Docker Hub**
bash
docker push your-dockerhub-username/new-image-name:tag
Example:

bash
`docker push yourusername/my-custom-image:v1`




for 2 topics 

```
rosrun kalibr tartan_calibrate \
  --bag /2025-05-29-10-40-46.bag \
  --target /catkin_ws/src/tartancalib/camera_calib.yaml \
  --topics /camera/infra1/image_rect_raw /camera/infra2/image_rect_raw \
  --models pinhole-radtan pinhole-radtan \ 
  --min-init-corners-autocomplete 15 \
  --min-tag-size-autocomplete 2 \
  --correction-threshold 1.0 \ 
  --dont-show-report \
  --save_dir /infra_1_2_calib
```

vins_4.py

```
root@5d32a80731d7:/# cat vins_4.py
#!/usr/bin/env python3
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
import tkinter as tk
from tkinter import messagebox

class RosTopicViewer:
    def __init__(self, master):
        self.master = master
        self.master.title("ROS Topics Viewer")

        self.bridge = CvBridge()
        self.subscriber = None

        # Listbox to display topics
        self.listbox = tk.Listbox(master, width=50, height=20)
        self.listbox.pack(padx=10, pady=10)

        # Button to subscribe to selected topic
        self.btn_subscribe = tk.Button(master, text="Subscribe to Selected Topic", command=self.subscribe_topic)
        self.btn_subscribe.pack(pady=5)

        # Refresh topics button
        self.btn_refresh = tk.Button(master, text="Refresh Topic List", command=self.load_topics)
        self.btn_refresh.pack(pady=5)

        # Load the initial topic list
        self.load_topics()

    def load_topics(self):
        # Clear the listbox
        self.listbox.delete(0, tk.END)

        # Get all published topics
        topics = rospy.get_published_topics()

        # Filter only topics publishing sensor_msgs/Image messages
        self.image_topics = []
        for topic, ttype in topics:
            if ttype == "sensor_msgs/Image":
                self.listbox.insert(tk.END, topic)
                self.image_topics.append(topic)

        if not self.image_topics:
            self.listbox.insert(tk.END, "No Image topics available.")

    def subscribe_topic(self):
        # Get selected topic
        selection = self.listbox.curselection()
        if not selection:
            messagebox.showwarning("No selection", "Please select a topic first.")
            return

        topic = self.listbox.get(selection[0])
        if topic == "No Image topics available.":
            messagebox.showwarning("Invalid selection", "Please select a valid image topic.")
            return

        # Unsubscribe if already subscribed
        if self.subscriber:
            self.subscriber.unregister()

        # Subscribe to the new topic
        self.subscriber = rospy.Subscriber(topic, Image, self.image_callback)
        rospy.loginfo(f"Subscribed to {topic}")

    def image_callback(self, msg):
        try:
            cv_image = self.bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8')
            cv2.imshow("Image from topic", cv_image)
            cv2.waitKey(1)
        except CvBridgeError as e:
            rospy.logerr(e)


if __name__ == '__main__':
    rospy.init_node('ros_topic_image_viewer', anonymous=True)

    root = tk.Tk()
    app = RosTopicViewer(root)

    try:
        tk.mainloop()
    except KeyboardInterrupt:
        pass
    finally:
        cv2.destroyAllWindows()
```

vins_3.py

```
#!/usr/bin/env python3
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2

def image_callback(msg):
    try:
        # Convert ROS Image message to OpenCV image
        cv_image = bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8')
        # Show the image in a window
        cv2.imshow("Camera Feed", cv_image)
        cv2.waitKey(1)  # 1 ms delay to keep window responsive
    except CvBridgeError as e:
        rospy.logerr(e)

if __name__ == '__main__':
    rospy.init_node('cam_viewer', anonymous=True)
    bridge = CvBridge()

    # Subscribe to the USB camera image topic
    rospy.Subscriber("/feature_tracker/feature_img", Image, image_callback)

    rospy.loginfo("Starting USB Camera Viewer...")

    try:
        rospy.spin()
    except KeyboardInterrupt:
        pass
    finally:
        cv2.destroyAllWindows()
```

FOR cleaning up ystem use 

`sudo rm -rf /var/lib/docker`
cal pull on later but tremember to store in docker hub orfirst