Running Robot in 3D Scene

To run robot in the visual scene we use both applications: the server (BondSim3DVisual) to create a virtual scene and redraw it and the client (BondSim) to simulate system and drive the virtual scene. We connect them in the named pipe loop as shown below. The named pipe permits running these applications on the same or remote computers connected by a local link; in the last case we must supply the client with the server’s computer name.

The Named Pipe communication loop
The Named Pipe communication loop

To create the virtual scene and drive the robot (see the figure below):

  • - Load BondSim 3D Visual program.
  • - Select command Create Virtual Scene in menu File and in the dialog that opens select project Puma 560. Accept default background color and click OK button.
  • - When the virtual screen is constructed with the robot in it pick BondSim3DVisual program frame by the title and move it e.g. to the left top position on the computer screen.
  • - Load BondSim program.
  • - Activate Model Library tab and expand Projects branch. Select project Puma 560 and right-click it and when the menu drops down select command Copy to the Workspace.
  • - Click Open Project toolbar button (the second from the left) and in dialog box that opens select Puma 560 project and click OK
  • - The Puma 560 project opens. We may change the size of the client frame window and retain only the central part. Drag the frame e.g. to the right so that it does not cover the server (see below). Click Build button. Observe the message that appears in Output window.

Now the both applications are ready to communicate and work jointly. We do the following:

  • - Click BondSim3DVisual title to activate the virtual scene. In menu Operation select command Start IPC. The server now creates the IPC pipe and waits for the client to connect to.
  • - The next, click on Bond Graph model to activate the client, open the Simulation menu and select command Connect IPC Socket.  A dialog opens requiring the server computer's name. Here, as the both programs are loaded on the same computer and thus the client knows where the server is, we may simply click OK.
  • - The client now connects to the server’s pipe object. If the connection went well, the server creates a separate thread for listening messages received by the pipe from the client. The communication was now established and we can start the simulation.

Computer screen with Puma virtual screen (on the top left) and its Bond Graph model

                                                  Computer screen with Puma virtual screen (on the top left) and its Bond Graph model (on the bottom right)

 Thus, we click Run button (a large red arrow one) to start simulation and simulation option dialog opens as shown below.

Simulation options
Simulation options


This is the same dialog we already encountered (see BondSim, Running the Simulations).

  • - We can accept the simulation parameters already set and click Restart button. Note, however the Output Delay box, which specifies 50 ms. It does mean that every 50 ms the values of joint angels that are evaluated during the simulation run are collected, packed into a message and sent to the server to redraw the scene. After receiving the message the server recalculates the position of the all changed objects and updates the scene. Thus, there are 1/0.050 = 20 generated scene updates (movie frames) per second. If we use a much lower delay (much higher frames per second rate) the scene could blink. This value of the frames per second is close to the movie frame standard. 
  • - Now we may view the motion of Puma arms until end of simulation, which occurs relatively quickly.  We can repeat the simulations and IPC session as the scene is still active until we close the simulation session by clicking End Simulation button.
  • - We may record the Puma motion as an .avi file. To do it, before the start of a simulation run, we return back to the Server and in menu File select command Start Movie. This command opens a dialog which requires the .avi filename and where to store it. By accepting the command by OK the recortings starts.
  • - When the simulation finishes we again open server menu File and select End Movie.  The server closes and saves the .avi file. We may afterwards replay this file by the most media players. Several such files are played on the web's Home page.