ROS2 Service Server: Multiply Two Floats

Easy Services 0% pass rate

Practice the ROS2 Service Server: Multiply Two Floats coding problem in Services. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.

Problem Statement

Create a multiplication service — a common pattern for offloading computation to a dedicated ROS2 node.

Requirements

  • Node name: multiplier_service
  • Service name: /multiply_floats
  • Service type: example_interfaces/AddTwoInts (reuse this standard type — treat a and b as floats, return a * b as the sum field)
  • Implement the service callback to return the product of the two inputs
  • Spin the node so it stays alive and handles requests

Input/Output Format

Request: a (int64), b (int64) — treat these as your two operands
Response: sum (int64) — return the product a * b

⚠️ Common Pitfalls

  • Returning a + b instead of a * b — this is a multiplication service
  • Forgetting to call rclpy.spin(node) after creating the service
  • Using the wrong field name: the response field is called sum (from AddTwoInts), not product

📚 Helpful Resources

Frequently asked questions

What is the ROS2 Service Server: Multiply Two Floats practice problem?

It is a hands-on Services challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.

How do I practice ROS2 Service Server: Multiply Two Floats online?

Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.

What skills does ROS2 Service Server: Multiply Two Floats test?

This Easy problem focuses on Services skills used in robotics interviews and production systems.