macrobomaster / cv-yolov7

Custom yolov7 model with opencv
GNU General Public License v3.0
5 stars 3 forks source link

Game Interface with C#/Unity #27

Open Bill-Haoyu-Lin opened 1 year ago

Bill-Haoyu-Lin commented 1 year ago

Here is the Enlgish Version of Rulebook https://terra-1-g.djicdn.com/b2a076471c6c4b72b574a977334d3e05/RM2023/RoboMaster%202023%20University%20League%20Rules%20Manual%20V1.2%EF%BC%8820230420%EF%BC%89.pdf

Bill-Haoyu-Lin commented 1 year ago

Here is some video that maybe helpful: https://www.youtube.com/watch?v=UDoMn8qWzrM&ab_channel=HKUCSMakerLab

Link: https://github.com/chenjunnn/rm_vision_simulator

Bill-Haoyu-Lin commented 1 year ago

image

Bill-Haoyu-Lin commented 1 year ago

pygame is fine

Allen-ENGI commented 1 year ago

image

Allen-ENGI commented 1 year ago

add more details to the game, redesign the map ->to be realistic

Allen-ENGI commented 1 year ago

image redesigned in Unity

Allen-ENGI commented 1 year ago

https://drive.google.com/file/d/1lYouhdBe6IB-jH1n0t0adYfscFSKqUi_/view?usp=sharing

frankvp11 commented 1 year ago

temp.txt Forgive me for uploading this file - this is just so that I can save the state of how I got to where I am now, and how to get there again. The dockerfile that I am using is this:

# Use a ROS 2 Humble base image for arm64 architecture
FROM osrf/ros:humble-desktop

# Set the maintainer label
LABEL maintainer="Zhenpeng Ge <zhenpeng.ge@qq.com>"

# Install system dependencies
RUN apt-get update && apt-get install -y \
    ignition-fortress \
    libignition-cmake2-dev \
    ros-humble-ros-gz \
    python3-pip \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies if there are any (not provided in the info but just in case)
# RUN pip3 install <python-package-name>

# Set up ROS2 workspace
RUN mkdir -p /simulator_ws/src

WORKDIR /simulator_ws/src

# Clone necessary repositories
RUN git clone https://github.com/robomaster-oss/rmoss_gazebo.git -b humble
RUN git clone https://github.com/robomaster-oss/rmoss_interfaces.git -b humble
RUN git clone https://github.com/robomaster-oss/rmoss_core.git -b humble
RUN git clone https://github.com/robomaster-oss/rmoss_gz_resources.git -b humble --depth=1

# Install ROS dependencies
WORKDIR /simulator_ws
RUN rosdep update

# Install the missing camera_info_manager package
RUN apt-get update && apt-get install -y ros-humble-camera-info-manager

# Build the workspace
RUN /bin/bash -c '. /opt/ros/humble/setup.bash; colcon build'

# Source setup script for the workspace in bashrc so it gets sourced on container start
RUN echo "source /simulator_ws/install/setup.bash" >> ~/.bashrc

# Expose container's graphical interface to the host
ENV DISPLAY=:0

# Default command to keep the container running without exiting
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

This is the repo that I am trying to use: https://github.com/robomaster-oss/rmua19_gazebo_simulator The reason that I am using this repo (over other repos), is because a) I can actually get this one "working" (the other ones I can't even get close to running a docker container), and b) it is in ROS meaning we can access the 3d positionings, and its prebuilt lol

frankvp11 commented 1 year ago

Steps to reproduce: 1) Create a Dockerfile file, and copy / paste the contents of the previous post inside of there 2) Build the Dockerfile:

docker build -t my_rmoss_image .

3) Launch the Dockerfile:

docker run -it --rm --net=host --env="DISPLAY" -p 5000:5000 --volume="$HOME/.Xauthority:/root/.Xauthority:rw" my_rmoss_image

4) Go into the /simulator_ws/src directory, and run

git clone https://github.com/robomaster-oss/rmua19_gazebo_simulator.git

5) Then run cd ../, and then run

source install/setup.bash

6) Build the colcon files:

colcon build

7) Run the launch file:

ros2 launch rmua19_gazebo_simulator standard_robot_a_test.launch.py

You may have to install xmacro with pip (but I'm not too sure anymore). Then, it should open up the simulation. Current problems: 1) I tried running the

ros2 run rmoss_gz_base test_chassis_cmd.py --ros-args -r __ns:=/red_standard_robot1/robot_base -p v:=0.5 -p w:=0.5

in a seperate terminal but it doesn't work 2) Likewise, I tried running the web app found in the /scripts directory of the repo you cloned, but that also doesn't work properly

Potential Fixes: I know that you can allow docker containers to communicate over your network host or smt, which is definitely needed since it's my guess that they aren't currently communicating with eachother, hence why they won't "work"

frankvp11 commented 1 year ago

Update: To move the robot in a straight line (wow impressive right), this is what you need to do (works locally). First, download (and unzip) all the files attached here into a single directory. Then, run docker compose build (or docker-compose build if the other command doesn't work). Then, run docker compose up (or docker-compose up). 3Dsim.zip

Something to note: To move the robot, we need to make a publisher - which is a fancy python script essentially. The command that I am currently using for this is this:

ros2 topic pub /red_standard_robot1/cmd_vel geometry_msgs/msg/Twist '{linear: {x: 0.1, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}';

However, we now need to get that within a Python file, and then create the RL from #31 to make decisions in there.