I am having trouble executing the program script which comes with the controller-1 exercise solution.
Automatic.scripting.loadPrograms("../deployment/program.ops") Automatic.the_program.start()Does not step through the whole program, and freezes after the first "move". Stepping and so on results in errors / failures.
/Alex
Program script in controller-1-solution
On Thu, Nov 19, 2009 at 23:52, <alex [dot] stark [..] ...> wrote:
> I am having trouble executing the program script which comes with the controller-1 exercise solution.
>
> Automatic.scripting.loadPrograms("../deployment/program.ops")
> Automatic.the_program.start()
This is from the taskbrowser ?
>
> Does not step through the whole program, and freezes after the first "move".
Does
Program script in controller-1-solution
Doesn't. At least for me. For instance, step was being changed to an ever smaller value, so the termination tolerance went down. As a result it "reached its target" and then "unreached it".
Also, on my version the program wouldn't load. A couple of diffs are shown below.
/Alex
--- orocos/rtt-exercises-1.10.0/controller-1-solution/components/automatic/Automatic.hpp 2009-02-09 02:12:38.000000000 -0800
+++ components/automatic/Automatic.hpp 2009-11-20 08:59:54.000000000 -0800
@@ -23,6 +23,7 @@
{
protected:
double target, step;
+ double baseStep;
bool target_reached;
Command<bool(double)> move;
Event<void(double)> atposition;
@@ -30,13 +31,14 @@
DataPort<double> input;
bool move_impl(double d) {
+ step = baseStep;
target = input.Get() + d;
// step and d must have same sign.
if ( d * step < 0)
step = -step;
- if ( d < step ) {
+ if ( fabs(d) < fabs(step) ) {
output.Set(target);
log(Info) << "Did instant move to target "<< target <<endlog();
return true;
@@ -48,7 +50,7 @@
}
bool atpos_impl(double d) {
- if ( output.Get() - target < step && output.Get() - target > -step )
+ if ( fabs(output.Get() - target) < baseStep )
return true;
return false;
}
@@ -56,7 +58,8 @@
public:
Automatic(const std::string& name) :
TaskContext(name, PreOperational),
- target(0.0), step(0.0), target_reached(true),
+ target(0.0), step(0.0)
+ , baseStep(0.0), target_reached(true),
move("move",&Automatic::move_impl, &Automatic::atpos_impl, this),
atposition("atposition"),
output("output"),
@@ -90,7 +93,8 @@
bool startHook() {
// set our interpolation step to 1 unit/s.
- step = this->getPeriod();
+ baseStep = this->getPeriod();
+ step = 0.0;
return true;
}
--- orocos/rtt-exercises-1.10.0/controller-1-solution/deployment/program.ops 2009-09-15 01:33:52.000000000 -0700
+++ deployment/program.ops 2009-11-20 08:21:33.000000000 -0800
@@ -17,11 +17,14 @@
* Now change the script to repeat the a-b-c-d movement 5 times.
*/
- for( int i = 0; i < 5; ++i) {
- do move(5.0);
- do move(-30.0);
- do move(50.0);
- do move(-300.0);
- do move(0.0);
+ for (
+ var int i = 0;
+ i < 5;
+ set i = i+1 ) {
+ do move(5.0)
+ do move(-30.0)
+ do move(50.0)
+ do move(-300.0)
+ do move(0.0)
}
}
> I am having trouble executing the program script which comes with the controller-1 exercise solution.
>
> Automatic.scripting.loadPrograms("../deployment/program.ops")
> Automatic.the_program.start()
This is from the taskbrowser ?
>
> Does not step through the whole program, and freezes after the first "move".
Does
Re: Program script in controller-1-solution
Doesn't. At least for me. For instance, step was being changed to an ever smaller value, so the termination tolerance went down. As a result it "reached its target" and then "unreached it".
Also, on my version the program wouldn't load. A couple of diffs are shown below.
/Alex
> Automatic.scripting.loadPrograms("../deployment/program.ops") > Automatic.the_program.start()
This is from the taskbrowser ?
> > Does not step through the whole program, and freezes after the first "move".
Does