Hello everyone,
I am currently trying to get my arduino ROS node to work. I programmed an tested the whole code using the catkin workspace.
I now copied the code into the arduino IDE and suddenly a lot of functions, which previously worked just fine throw errors. I already fixed all but one: I need to determine an array length for further data processing. The code I used until now is:
int wp_size = msg.goal.trajectory.joint_trajectory.points.size();
Another method of finding out an arrays length seems to be:
int wp_size = sizeof( msg.goal.trajectory.joint_trajectory.points ) / sizeof( double );
This does not work, because the array is empty at compile time and thus the code above returns "1" every time.
The length of the array changes with every service call. Is there any other method to find out the length of the array?
Maybe the error message might help someone:
error: request for member ‘size’ in ‘msg.moveit_msgs::ExecuteTrajectoryActionGoal::goal.moveit_msgs::ExecuteTrajectoryGoal::trajectory.moveit_msgs::RobotTrajectory::joint_trajectory.trajectory_msgs::JointTrajectory::points’, which is of pointer type ‘trajectory_msgs::JointTrajectory::_points_type* const {aka trajectory_msgs::JointTrajectoryPoint* const}’ (maybe you meant to use ‘->’ ?)
If I use "->" though, I get:
error: ‘trajectory_msgs::JointTrajectory::_points_type’ has no member named ‘size’
Thank you in advance,
Felix
Originally posted by Felix_N on ROS Answers with karma: 115 on 2017-06-28
Post score: 0