Skip to content

Simulator error checking #107

@jrbaxter0

Description

@jrbaxter0

This bug leads to cryptic errors when the cause if very straightforward. Rather than crashing and giving a convenient error message when a necessary parameter wasn't given, the simulator skips to the next section of code.

This same practice may exist in several files in rktl_sim

Before:

        # Setting up ball
        ball_img_path = rospy.get_param("~BALL_IMG_PATH", None)
        if ball_img_path is not None:
            self.ball_id = id
            self.window.createAsset(
                self.ball_id, ball_radius * 2, ball_radius * 2, imgPath=ball_img_path)
            id += 1

After:

        # Setting up ball
        self.ball_id = id
        self.window.createAsset(
            self.ball_id, ball_radius * 2, ball_radius * 2, imgPath=rospy.get_param("~BALL_IMG_PATH"))
        id += 1

or

        # Setting up ball
        ball_img_path = rospy.get_param("~BALL_IMG_PATH")
        self.ball_id = id
        self.window.createAsset(
            self.ball_id, ball_radius * 2, ball_radius * 2, imgPath=ball_img_path)
        id += 1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions