Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Sending/Receiving network "messages" to either control an mBot2 robot or a 3D object in Unity

Discussion in 'Multiplayer' started by PascalPazek, May 24, 2023.

  1. PascalPazek

    PascalPazek

    Joined:
    May 22, 2023
    Posts:
    1
    Hello!

    So this might neither be the right place to ask nor the easiest thing to explain, but I thought if it would fit anywhere, since its network based, it'd be here. Hope that is fine.

    I am currently in an school based IT apprenticeship and we just started a project week today in terms of electronics and software programming.

    We were given mBot2 robots, which are these little cars that are controlled via an ESP32 basically, which offer a few sensors and such. ALso, we've begun working absolute basic stuff in Unity a week ago, and all we can do basically is create 3D models with the given tools and attach basic physics and scripts to them.

    Now the plan is the following: We have (self-built) models of these mBot2 robots in Unity that can be controlled via WASD on a simple plane.
    Now what we're supposed to achieve is, that the mBot, which has sonar sensors and can drive around until it meets an obstacle, then turns and keeps driving (think roomba vacuum robot like), drives around the room and it's movements are basically translated into our unity model. When the mBot2 hit's an obstacle, that obstacle shouls then appear inside unity.

    The mBot thing is pretty cool but heavily undocumented IMO, it works on python/scratch but we've been working in C# mainly and have never touched python.

    What I am trying to figure out now for a few hours, is how it would be possible to either

    - move the virtual bot in unity, which then sends network messages which are received by the mBot and then acts on them
    or
    - the mBot moves around on his own and the 3D Unity model mirrors it's movements

    How would/could this work? Did anyone ever try anything like this in the past or has any experience with the mBot's?
    The mBot2 allows to send and receive network messages, but in what form is pretty much unknown.

    Any help would be greatly appreciated!

    Thanks!