Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float() argument must be a string or a number, not 'LineString' in single_intersection_town6_carla file #210

Closed
SExpert12 opened this issue Jun 10, 2023 · 4 comments

Comments

@SExpert12
Copy link

I am working in Carla simulator. I required specific scenario for my simulation. So I have tried to run file named single_intersection_town06_carla and it it showing me error like "float() argument must be a string or a number, not 'LineString'". I traced the error and I found that in the file named core/map/map_manager.py the input is actually linestring. But I am not able to understand that how to solve this as shapely polygon and boundary function of polygon are completely new to me. How to resolve this error?
Here I have written the same function of the file map_manager.py:
def associate_lane_tl(self, mid_lane):
"""
Given the waypoints for a certain lane, find the traffic light that
influence it.

    Parameters
    ----------
    mid_lane : np.ndarray
        The middle line of the lane.
    Returns
    -------
    associate_tl_id : str
        The associated traffic light id.
    """
    associate_tl_id = ''

    for tl_id, tl_content in self.traffic_light_info.items():
        
        trigger_poly = tl_content['corners']
        print("\n\n corners",tl_content['corners'])
        print("\n\n trigger_poly",trigger_poly) # printing values
        print(type(trigger_poly))
        # use Path to do fast computation

        trigger_path = Path(float(trigger_poly.boundary))

        print("trigger_path",type(trigger_poly.boundary))

        # check if any point in the middle line inside the trigger area
        check_array = trigger_path.contains_points(mid_lane[:, :2])

        if check_array.any():
            associate_tl_id = tl_id
    return associate_tl_id

LinestringError

@DerrickXuNu
Copy link
Contributor

Hi, this is probably caused by the Shapely version. What is your Shapely version?

@SExpert12
Copy link
Author

Name: shapely
Version: 2.0.1

@DerrickXuNu
Copy link
Contributor

Yes, this is the reason. Please stick to the shapely version appeared in the requirement.txt

@SExpert12
Copy link
Author

Okay. But then I am getting problem with other packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants