Closed rgleichman closed 10 years ago
For large messages it would have been very tedious to initialize all of the fields. Now, instead of writing
Pr2GripperCommandActionGoal{
header= H.Header {H.seq= 0,
H.stamp = (0,0),
H.frame_id= ""},
goal_id= GID.GoalID {
GID.stamp = (0,0),
GID.id = ""
}
, goal=Pr2GripperCommandGoal{
command = Pr2GripperCommand{
position = closed, max_effort = (-1)
}
}
}
You can do this:
import Data.Default.Generics (def)
(def :: Pr2GripperCommandActionGoal){
goal=Pr2GripperCommandGoal{
command = Pr2GripperCommand{
position = closed, max_effort = (-1)
}
}
}
This is similar to how rospy initializes messages. The Haskell package used for this is data-default-generics
Thanks, this looks good. I tend to be skeptical about default value type classes, but typical usage of ROS message types does seem to lean that way.
...mporting Data.Default.Generics and doing (def ::).