The way that I would try to do thisanswer your original question is to add a field to your roads and update it with a count of vertices.
- Add a Long Integer field
- Calculate that field using the Python parser to be equal to
!shape.pointcount!
,
You can then use the vertex count field as, or to contribute to, your impedance field.
You'll need to think about whether an almost straight road with lots of vertices should be treated as "straight" for your purposes, and maybe also about how you will deal with roads that consist of many lines.
@user30184 has offered some very useful advice as a comment that I will append here:
Probably it would be best to clean the roads from unnecessary dense vertices by simplifying. Alternatively you can think about other measures like a ratio of mathematical distance from the start node to end node vs. the length along the road or something like that.