# ros2 launch: Substitution error: parameter 'my_param' expected type 'double' but got 'integer'

- **ID:** `ros2/ros2-launch-parameter-substitution-type-mismatch`
- **Domain:** ros2
- **Category:** config_error
- **Error Code:** `ROS2-2001`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Launch file uses a substitution that evaluates to a type incompatible with the declared parameter type (e.g., integer vs double) due to LaunchConfiguration or Python substitution returning an int instead of float.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ros2:humble | active | — | — |
| ros2:iron | active | — | — |
| ros2:rolling | active | — | — |
| launch:2.0.0 | active | — | — |

## Workarounds

1. **Explicitly cast the substitution to the expected type using PythonExpression. Example:
from launch.substitutions import PythonExpression

param_value = PythonExpression(['float(', LaunchConfiguration('my_param'), ')'])

This forces the substitution to evaluate to a float.** (90% success)
   ```
   Explicitly cast the substitution to the expected type using PythonExpression. Example:
from launch.substitutions import PythonExpression

param_value = PythonExpression(['float(', LaunchConfiguration('my_param'), ')'])

This forces the substitution to evaluate to a float.
   ```
2. **In the launch file, use a typed substitution like FloatSubstitution if available, or ensure the LaunchConfiguration default is a float:
from launch.substitutions import LaunchConfiguration

param = LaunchConfiguration('my_param', default=0.0)  # default as float** (85% success)
   ```
   In the launch file, use a typed substitution like FloatSubstitution if available, or ensure the LaunchConfiguration default is a float:
from launch.substitutions import LaunchConfiguration

param = LaunchConfiguration('my_param', default=0.0)  # default as float
   ```

## Dead Ends

- **Changing the parameter type in the node's declaration to match the substitution type** — The node may expect a specific type for correct operation; changing the declaration can cause runtime errors in the node. (50% fail)
- **Wrapping the substitution in str() without converting to the correct numeric type** — String substitution will be interpreted as a string, not a number, causing a different type mismatch error. (90% fail)
