neuebot / FIBR3DEmul

Custom 3 and 5 axis FDM process simulator.
GNU General Public License v3.0
3 stars 2 forks source link

Communication Fail ! #1

Open Daredevil441 opened 4 years ago

Daredevil441 commented 4 years ago

hey carlos, im Solanki Divyraj. i have done all the things as u guided in readme & fulfilled every requirement it needed but it still show me connection error!. Screenshot (37)

neuebot commented 4 years ago

Hi Solanki,

I just did a clean install on a new machine but I could not reproduce that error :confused:

The Coppelia plugin starts a server at ports 1313 and 1315 of your IP address on your local network. That is where the interpreter will connect to. These are hard coded, but you can change them in, Server.cpp lines 245 and 246.

Let's try something, load and start the scene, open a command line and type: netstat -an

You should see the two following lines,

Then, launch the interpreter app and press Connect.

Type again netstat -an in another prompt, and you should see something like this (YOUR_IP:1313 and YOUR_IP:1315)

Hope it helps, :+1:

Daredevil441 commented 4 years ago

hey, i don`t have that IPs on PC before interpreter connection but after connection i got it on terminal but connection is not established.

this is before connection. Screenshot (40)

this is after connection. Screenshot (41)

connection is not establishing , but i got different kind of IPs so what IP i should replace in server.cpp ?

neuebot commented 4 years ago

That is strange... Your 'after connection' is the same as my 'before connection' cmd interface. It seems that the simulation is not running or the plugin was not initialized in your first image.

When you load the scenario and start the simulation, it initializes the plugin and starts the server in ports ::::1313 and ::::1315. That is what you have in your second image.

Did you follow these steps? -> https://i.imgur.com/UKYKbTL.gif

What happens when you actually launch and press connect on the Interpreter app? Does the CoppeliaSim show any messages in the status bar?

Daredevil441 commented 4 years ago

yes, i followed as u suggested in video.

when i tried to connect its shows me below error... Screenshot (43)

this is console window & bottom status bar still showing " waiting for connection...." Screenshot (44)

this is IPs status... Screenshot (46)

cf-dtx commented 4 years ago

The IP should not be an issue, the client program checks for your IP address (https://github.com/neuebot/FIBR3DEmul/blob/master/gcode_interpreter/GCodeInterpreter/SocketClient.cs),

// Establish the remote endpoint for the socket.  
// The name of the host device: Dns.GetHostName()
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
foreach (var ip in ipHostInfo.AddressList)
{
    if (ip.AddressFamily == AddressFamily.InterNetwork)
    {
        ipAddress = ip;
    }
}
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port_);
IPEndPoint remoteEP2 = new IPEndPoint(ipAddress, port2_);

The only thing I set manually were the ports,

// The port number for the remote device [manually set 1313]
private const int port_ = 1313;
private Socket mClient;
private const int port2_ = 1315;
private Socket mClient2;

I would suggest launching the Interpreter app in debug mode, and checking whether ipAddress is 192.168.43.227 for you. I think the problem might be here, in the client side.

As a second option and if you want, you can try to change the ports. Remember to manually set these in the server side as well, check the plugin file (https://github.com/neuebot/FIBR3DEmul/blob/master/v-rep_plugin/src/Server.cpp),

void CommunicationManager::LaunchServer()
{
    try
    {
        int port1 = 1313;
        int port2 = 1315;

        server = std::make_shared<Server>(&ios, port1, port2);

        //launch io_service in another thread
        bt = std::make_unique<boost::thread>(boost::bind(&boost::asio::io_service::run, &ios));
    }
    catch (std::exception& e)
    {
        //Send message to simulator
        v_repExtPQBarMsgCommunication(e.what());
    }
}

You can also debug the plugin, by attaching to the CoppeliaSim process, after or prior to launching the program. For more info see https://docs.microsoft.com/en-us/visualstudio/debugger/attach-to-running-processes-with-the-visual-studio-debugger?view=vs-2019