Comments (7)
If you're using cubic splines, all of the parameters are tuned to meet the needs of smoothing. You'd need more parameters in your spline to dedicate it to changing the curvature. Even then, the results of that tuning are surprising rather than controllable to some mathematical metrics.
This is where I typically use the tension splines, see the documentation here. They give you some control over the shape of the curve in a non-surprising way that can even be tuned to meet acceleration limits.
from ecl_core.
Your backtrace points to this code. Are you filling both x_set
and y_set
appropriately?
Do you have example code that is failing?
from ecl_core.
Well the answer is no, I'm not doing it the right way.
x_set is defined as ecl:: Array x_set (wp_total); where wp_total is poseListX. size ().
posListX is defined as std:: vector
poseX is defined as double.
void UALPathCallback(const nav_msgs::Path& msg){
msgDrawPath.header.frame_id = "map";
msgDrawPath.poses = msg.poses;
for(auto p : msg.poses){
waypoint.pose.position.x = p.pose.position.x;
waypoint.pose.position.y = p.pose.position.y;
waypoint.pose.position.z = p.pose.position.z;
poseList.push_back(waypoint);
poseX = p.pose.position.x;
poseListX.push_back(poseX);
poseY = p.pose.position.y;
poseListY.push_back(poseY);
poseZ = p.pose.position.z;
poseListZ.push_back(poseZ);
}
Then
double * wp_x = (double*)malloc(sizeof(double)*wp_total);
double * wp_y = (double*)malloc(sizeof(double)*wp_total);
double * wp_z = (double*)malloc(sizeof(double)*wp_total);
for(int i=0; i<wp_total; i++){
wp_x[i]=poseListX[i];
wp_y[i]=poseListY[i];
wp_y[i]=poseListZ[i];
}
double * x_ptr;
double * y_ptr;
double * z_ptr;
x_ptr = wp_x;
y_ptr = wp_y;
z_ptr = wp_z;
ecl::CubicSpline spline_x;
ecl::CubicSpline spline_y;
ecl::CubicSpline spline_z;
for (int i = 0; i < wp_total; i++)
{
t_set[i] = (double)i;
x_set[i] = x_ptr[i];
y_set[i] = y_ptr[i];
z_set[i] = z_ptr[i];
}
spline_x = ecl::CubicSpline::Natural(t_set,x_set);
spline_y = ecl::CubicSpline::Natural(t_set,y_set);
spline_z = ecl::CubicSpline::Natural(t_set,z_set);
Thank you for responding so quickly.
from ecl_core.
Can you check t_set, x_set, y_set and z_set sizes at the time of the exception?
from ecl_core.
All three are zero.
If instead of subscribing to a topic with nav_msgs:: path I enter a path as follows:
wp_x[0] = 10; wp_x[1] = 12.5; wp_x[2] = 12.5; wp_x[3] = 12.5;
wp_y[0] = 10; wp_y[1] = 10; wp_y[2] = 12.5; wp_y[3] = 15;
wp_x[4] = 15; wp_x[5] = 17.5; wp_x[6] = 17.5; wp_x[7] = 17.5;
wp_y[4] = 15; wp_y[5] = 15; wp_y[6] = 17.5; wp_y[7] = 20;
wp_x[8] = 20; wp_x[9] = 22.5; wp_x[10] = 22.5; wp_x[11] = 22.5;
wp_y[8] = 20; wp_y[9] = 20; wp_y[10] = 22.5; wp_y[11] = 25;
int wp_total = 12;
It works perfectly without touching up anything else from the code. But as i said before, i need to suscribe to a topic.
By the way, i checked this topic and its working fine, thats why I think that I am making mistakes with variable types.
from ecl_core.
I found the error. I was reading the topic well with nav_msgs/Path but I wasn't saving its variables well so the size of x_set. y_set and z_set gave me zero.
Thank you so much for the help.
from ecl_core.
Hi, I don't know if I am using the issue system correctly but being the same person and the question related to the previous one, I reopen the issue.
Is it possible to change the curvature of the spline? Theoretically it is supposed that modifying the values of t_set should change the curvature, I have tried but without success.
I leave a picture of my 3D path today:
I think I should modify the values of t_set in this part, instead of going from 1 to 1, that goes from 0.5 to 0.5 but I can't get it to modify the curvature. The code part is as follows:
ecl:: Array<double> t_set (wp_total);
ecl:: Array<double> x_set (wp_total);
ecl:: Array<double> y_set (wp_total);
ecl:: Array<double> z_set (wp_total);
for (int i = 0; i < wp_total; i++)
{
x_set[i] = x_ptr[i];
y_set[i] = y_ptr[i];
z_set[i] = z_ptr[i];
t_set[i] = (double)i;
}
Basically what I want to do, which I don't know if it is possible, is to give the function run times on each waypoint. In this way the curvature would have to be more or less aggressive to meet those times.
Thank you very much.
from ecl_core.
Related Issues (20)
- ecl in Noetic HOT 12
- Build warning for threads
- Deprecate LegacyPose2D
- Error: Packages with unknown build types exist.
- required eigen version on Ros melodic HOT 1
- Building on OS X and Windows HOT 2
- Release to Galactic/Rolling HOT 3
- CONCEPT_CHECK_FAILED HOT 1
- Have no "ecl_config" package HOT 1
- Failing to build when using ament `--symlink-install` HOT 2
- Release into Melodic HOT 2
- warning: dynamic exception specifications are deprecated in C++11 HOT 2
- Redact library exports
- error during install melodic version HOT 2
- ROS2 Arm Builds HOT 3
- Duplicate packages "ecl_mobile_robot" when compiling kobuki_core HOT 3
- compliation issue on Melodic HOT 1
- Smooth Linear Spline causing massive deviations in position HOT 2
- Exceptions for ecl::Serial seem to be empty
- Warning/error compiling against nullary_function.hpp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ecl_core.