View unanswered posts | View active topics It is currently Mon Sep 01, 2014 9:54 pm






Reply to topic  [ 7 posts ] 
Undefined procedure HTACreadX and floor DriverSuite 2.4 
Author Message
Novice

Joined: Thu Apr 17, 2008 6:04 am
Posts: 70
Location: Plymouth, Indiana, USA
Post Undefined procedure HTACreadX and floor DriverSuite 2.4
Hello,
With the holiday season, I finally got some time to get out my MindStorms. :D
Downloaded the latest driver suite (2.4). Compiled a couple of old programs just to make sure everything was working and got two error messages. Went back to the old driver suite (1.7.1) and the errors went away. The error messages are:
undefined procedure for floor
undefined procedure for HTACreadX

I am clueless, but I took a look at the HTAC driver.
HTAC driver in 1.71 had the following lines:
bool HTACreadAllAxes(tSensors link, int &x, int &y, int &z);
bool HTACreadAllAxes(tMUXSensor muxsensor, int &x, int &y, int &z);
bool HTACreadX(tSensors link, int &x);
bool HTACreadX(tMUXSensor muxsensor, int &x);
bool HTACreadY(tSensors link, int &y);
bool HTACreadY(tMUXSensor muxsensor, int &y);
bool HTACreadZ(tSensors link, int &z);
bool HTACreadZ(tMUXSensor muxsensor, int &z);

HTAC driver in 2.4 was missing all the lines after the first line (in the above). Could this be the problem?
Using RobotC 2.02

Thanks for the help,
Dave

_________________
Dad (Dave) and Adam


Fri Dec 16, 2011 10:39 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
Hiya Dave,

There were many API changes between my 1.x and 2.x driver suites. You'll have to modify your old programs to make them work. Backwards compatibility is not guaranteed :)

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Dec 17, 2011 4:46 am
Profile WWW
Novice

Joined: Thu Apr 17, 2008 6:04 am
Posts: 70
Location: Plymouth, Indiana, USA
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
Hi Xander,
I see the comment in the sample program HTAC-Test1 (from 2.4): "Removed single axis functions". So that explains why the HTACreadX no longer worked. I can fix that.
I havn't been able to find what to do about the "undefined procedure 'floor'".
The error message about the flloor comes up for me even when compiling the sample program HTAC-test1 from 2.4. The comments in HTAC-test1 (2.4) say "Removed common.h from includes". The error is in common.h (line 321).

The dates and times (all from 2.4) of the three files involved are:
HTAC-test1 2011-09-06 13:52:43 (compiling this produces the floor error)
common.h 2011-11-30 19:03:16 (the floor error in in this file, line 321)
HTAC-driver.h 2011-04-27 13:00:05 (this is included in HTAC-test1)

Thanks for the help,
(I'm a bit rusty at all this),
Dave

_________________
Dad (Dave) and Adam


Sat Dec 17, 2011 6:54 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
That might be due to the fact that you're using ROBOTC 2.x. I will investigate.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Dec 17, 2011 7:02 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
floor() is a 3.x function, so I've made a work-around for you. However, note that rounding from floats to an int doesn't work very nicely when you have a number like -0.5, which seems to be more like -0.4999999, so I've worked around that, too.

Code:
int round(float number) {
  long foo = ((number * 10000) + sgn(number) * 5001) / 10000;
  return foo;
}

task main () {
  for (float i = -1.0; i <= 1.0; i+= 0.1)
  {
    writeDebugStreamLine("%f, %d", i, round(i));
  }
}


Please test this and let me know how it works for you.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Dec 18, 2011 6:44 am
Profile WWW
Novice

Joined: Thu Apr 17, 2008 6:04 am
Posts: 70
Location: Plymouth, Indiana, USA
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
Hi Xander,
I went ahead and upgraded to 3.04 and the problem was fixed (as expected).
Thanks for the work-a-round, but upgrading to 3.04 gives a long term solution.

Merry Christmas,
Dave

_________________
Dad (Dave) and Adam


Sun Dec 18, 2011 7:41 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3209
Location: Rotterdam, The Netherlands
Post Re: Undefined procedure HTACreadX and floor DriverSuite 2.4
Hey Dave,

The rounding error still occurs in 3.04, -0.5 is rounded to 0. I've notified the devs about it but I fear that it's inherent to using floats.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Dec 18, 2011 7:48 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.