Custom Action Message

I have been having an issue creating a custom action message and unable to figure out the error.
When I use this :
image

It compiles well and generates all the action topics.

But when I change the above to :
image

I get an error as such:


I believe I added all the necessary dependencies to the CMakelists file. Could anyone look and help me out.
I am guessing that there is a package for type Point[] and should include in the dependencies also? I am not sure
Thank You

Hi @mamojiz97 ,

Point[] by itself does not exist as a datatype. It is a sub-type under geometry_msgs.
You should re-write the line as geometry_msgs/Point[].

You can use geometry_msgs/Point32[] for 32 bit float.
You can use geometry_msgs/Point[] for 64 bit float.
Point32 type is used in most cases as it gives you precision up to 7 decimal places, which is sufficient for most applications.
Point would be useful only in cases of GPS-like systems where you need (very) high-precision, because you would need up to 9 or 10 places of decimal values.

Your custom action message definition seems to be quite vague.
Why have you defined a count variable with geometry_msgs/Point[] datatype?
Point32[] / Point[] datatype has x , y , z as three float-type values.
If you are just counting something you could just use int-based datatype.

Anyways, it was just my suggestion. You can use your definitions as per your requirements.

Regards,
Girish

2 Likes

@girishkumar.kannan
Thank You so much for your help. While I posted the question, I had found the solution as well.
I will make the necessary changes like you said. The variables names are just left as is just until the message was compiled.

I do have a following question though. Where should I search for the datatype of a sub type?
I just came across an article but it wasn’t a dataset to show that these ‘so and so’ are sub types of this datatype.
Thanks
Mojiz

Hi @mamojiz97 ,

The best way is to do rosmsg list in your computer (or on the machine on which ROS is installed).

Attention: rosmsg list will list all messages in your computer, you can scroll down and choose the message type that you wish to use.

Here is an example: (this lists all ros package messages with “Point” in its name)

user:~$ rosmsg list | grep Point
control_msgs/PointHeadAction
control_msgs/PointHeadActionFeedback
control_msgs/PointHeadActionGoal
control_msgs/PointHeadActionResult
control_msgs/PointHeadFeedback
control_msgs/PointHeadGoal
control_msgs/PointHeadResult
geographic_msgs/GeoPoint
geographic_msgs/GeoPointStamped
geographic_msgs/WayPoint
geometry_msgs/Point     #   <<<---------- Point64 msg
geometry_msgs/Point32   #   <<<---------- Point32 msg
geometry_msgs/PointStamped
image_view2/PointArrayStamped
jsk_interactive_marker/JointTrajectoryPointWithType
jsk_recognition_msgs/ClusterPointIndices
jsk_recognition_msgs/PointsArray
jsk_recognition_msgs/SlicedPointCloud
map_msgs/PointCloud2Update
moveit_msgs/CartesianPoint
moveit_msgs/CartesianTrajectoryPoint
opencv_apps/Point2D
opencv_apps/Point2DArray
opencv_apps/Point2DArrayStamped
opencv_apps/Point2DStamped
pcl_msgs/PointIndices
rtabmap_ros/KeyPoint
rtabmap_ros/Point2f
rtabmap_ros/Point3f
sensor_msgs/PointCloud
sensor_msgs/PointCloud2
sensor_msgs/PointField
teb_local_planner/TrajectoryPointMsg
trajectory_msgs/JointTrajectoryPoint
trajectory_msgs/MultiDOFJointTrajectoryPoint

But there is a caveat. Doing rosmsg list will only show the message packages installed on the system that is running ROS. So if you are looking for a specific message type that requires a ros-noetic-<pkg> to be installed on your system, then that message will not show up when you do rosmsg list until you install that specific ros package.

Finally, to know how a message is defined, you can do rosmsg show <msg_full_name>

user:~$ rosmsg show geometry_msgs/Point32
float32 x
float32 y
float32 z

So your options are as follows:

  1. Try to make use of the basic message types that gets installed with ROS default installation.
  2. Google (or search the web) for the specific message if it is not installed and install the package.
  3. Create your own message type, but make sure you do not multiple copies of same message.

I hope this clarified your doubt(s).

Regards,
Girish

2 Likes