Creating a custom simulation object – a robotic crane in AnyLogic software

Robotic arms (cranes) in a warehouse

As you may have noticed, our company name implies that you can implement any logic you need. In AnyLogic, we tend to develop markup components like conveyors, cranes, and elevators, as well as pre-built logic blocks to simplify your model development experience. This means you can create complex simulation models without deep Java programming knowledge.

But what if you need to add a unique object, like a custom robotic crane (robotic arm), to your conveyor system? Indeed, nowadays, it's difficult to find a big manufacturing company that doesn't have them. Fortunately, AnyLogic simulation software allows you to design and integrate your own robot into the model.

This blog post is designed to help you do just that. You will learn how to create a custom robotic crane, step-by-step. Note that this process can be applied to any custom object you need in your simulation models.

Worth mentioning is that this guide is intended for experienced AnyLogic users. So, if you are just getting started with our simulation software, you should take a look at the Getting Started page and cover the basics before trying to follow this guide.

With that being said, let's start by defining the structure and functionality of your custom robotic crane.

Table of contents:

  1. Designing a robotic crane
  2. Creating and parameterizing the robot links
  3. Implementing movement and parameterization
  4. Organizing parameters for user customization
  5. Adding the robotic crane to your model
  6. Creating a custom block for task management
  7. Establishing the task management logic
  8. Exporting the model for reuse

Step 1: Designing a robotic crane

To begin, a robot requires a representation object in the simulation to function effectively. It should be able to move objects between locations and have adjustable parameters, such as speed and height. Based on these specifications, it is clear that an agent-based modeling approach is the most suitable method in this case. Therefore, start by creating an agent named Robot.

Step 2: Creating and parameterizing the robot links

A link in a robotic crane is a rigid component that connects joints, allowing movement and support. So, create a two-link robotic crane, representing each link through a separate agent. This approach is necessary because of the complex formulas used for calculating movements. It also enables you to parameterize each link, for example, by adjusting its length.

For visual representation, import custom “.dae” objects for each link. After integrating these link agents into the robot agent's markup space, the robotic crane appears as shown below.

Visual representation of the robotic crane in AnyLogic simulation software
Visual representation of the robotic crane in AnyLogic simulation software

Step 3: Implementing movement and parameterization

The most challenging aspect of robot modeling is devising a mechanism that allows the robot's links to coordinate when lifting and moving an object. This process involves complex mathematical calculations, which we won't cover in detail here, as our focus is on demonstrating custom logic.

If you aim high and want to fully leverage the benefits of simulation modeling for your business, explore the fundamentals of Material Handling Simulation. Make sure that your projects address all your needs.

One of the key aspects of AnyLogic simulation software is the ability to parametrize simulated objects. In this case, you can adjust attributes like the width of the robot's links, vertical speed, rotation, etc. To achieve this, introduce specific parameters into your Robot agent. These parameters will be placed in the Parameters preview section of the agent's properties, as shown below.

Parameters preview section of the robot agent in AnyLogic
Parameters preview section of the Robot agent

Step 4: Organizing parameters for user customization

From the image above, you can see that it's possible to spread parameters among different sections. For example, you can group all parameters that change the robotic crane appearance in the respective section, while others can be placed in the Parameters section.

Once you add the robotic crane to the model, you will find these sections within the agent's properties. This will allow you to adjust the necessary parameters before the model run.

Adjusting necessary parameters for custom robotic crane in AnyLogic simulation software
Adjusting necessary parameters for a custom robotic crane in AnyLogic simulation software

Step 5: Adding the robotic crane to your model as a markup element

Your Robot agent is now ready to be placed anywhere in your model, functioning as a space markup element. This means the robotic crane waits for a task and, upon receiving one, executes the defined logic internally. However, you still need to add a component that can manage tasks effectively.

Step 6: Creating a custom block for task management

AnyLogic simulation software provides default blocks for setting the logic, but none of the standard options fit our specific needs to connect an inbounding agent with the robotic crane. Fortunately, AnyLogic allows you to create custom blocks and integrate them with the default ones.

Each block in AnyLogic acts as an agent and includes an icon for representation and ports for connections with other blocks. Therefore, let's create a new agent and name it MoveByRobot. This agent is equipped with necessary icons, ports, and parameters such as Robot, which allows selecting a specific robot for moving an object to its destination.

Step 7: Establishing the task management logic

In AnyLogic, each block has On enter or On exit action fields, where you can write code that will be executed when an agent enters and exits the block. These fields are created with Action type parameters defined inside your block agent.

On enter or On exit action fields, created with Action type parameters in AnyLogic simulation software
On enter or On exit action fields, created with Action type parameters

Once the parameter (for example, onEnter()) is activated, a code defined by you in the action fields runs. In our case, this code indicates that when an agent enters this block, it triggers the movement of an object. Now you can place your block in any position within a flowchart and set the defined parameters.

Setting the defined parameters in Actions fields in AnyLogic simulation software
Setting the defined parameters in Actions fields

Step 8: Exporting the model for reuse

The final step is to establish the block's logic and assign the task to the robotic crane. In this case, the internal logic involves Queue and Delay blocks, where a message is sent to the robot. The robotic crane then executes its internal logic and transports the object from its current position to its intended destination.

As a result, you have successfully created a customized block and a markup space element that drives the process. Now you can place multiple instances of these elements in a top-level agent, such as Main, to construct a manufacturing line where robots handle details. The logic described above is available for further investigation within the model.

Additionally, you've designed this model so the robotic crane can be reused as a library object. So, now let's export this model for use in your own projects. If you need the model for future use, you can find and download it from AnyLogic Cloud.

To export the library, right-click on the model in the project tree, select NewLibrary, and give your library a name. In the window that appears, select the agents you wish to make available (in this case, the Robot and MoveByRobot agents), assign icons, and write a description if you need to. Once everything is set, click Export the library in the bottom left corner.

Exporting the custom library for reuse in AnyLogic simulation software
Exporting the custom library for reuse

The model will be exported as a ".jar" file that can be added to the Palette of any project and then presented in the model's dependencies alongside the default libraries. So, finally, your robotic crane is ready for use in any of your projects as an integrated object.

Adding RobotLibrary to the model's dependencies in AnyLogic simulation software
Adding RobotLibrary to the model's dependencies

You've just created our own robotic crane from scratch using AnyLogic simulation software. Moreover, now you can develop any other custom object in a similar way.

If you don't program yourself, life will program you!
— Les Brown, an American politician and motivational speaker

So, anytime you want to create your own custom robot or object, just follow this guide. This way, you can bring your innovative ideas to life without waiting for their official release by our team.


Go ahead and recreate the steps described on your own. Just launch AnyLogic and unleash your creativity by modeling a custom robotic crane.

Get AnyLogic

Postes connexes