Society of Robots - Robot Forum

Software => Software => Topic started by: mallster on July 21, 2012, 07:04:48 PM

Title: ERP using webbot's Project Designer
Post by: mallster on July 21, 2012, 07:04:48 PM


Hi,

I am trying to convert and modify admins ERP 2.08 code for use with webbots project designer. To make it easy to add and remove new hardware.

I have had the following errors:

C:/Users/Greg/Documents/ERP_WebbotLib/special_motions.h:40:22: error: 'class Servo' has no member named 'actuator'

I have tried a number of things but am stuck on what could be a simple use of the webbot library.

Any help is much appreciated. (see attached .jpgs) I am using latest win-avr 20100110. and avr studio 4

Greg
Title: Re: ERP using webbot's Project Designer
Post by: Gertlex on July 21, 2012, 07:15:00 PM
I think you could get away with putting get_servo_positions() in your Walle_Axon_v2.cpp file rather than the header file OR doing #include hardware.h in the header file having problems.

This thread (http://www.societyofrobots.com/robotforum/index.php?topic=14907.0), especially Webbot's explanation, is perhaps tangentially related and may give you a better understanding of how to structure the files making up your robot's code.

Edit: also happened to notice that you include hardware.h twice in your .cpp file. Not that that's actually a problem...
Title: Re: ERP using webbot's Project Designer
Post by: mallster on July 21, 2012, 07:28:41 PM
Thanks Gertlex,

I did try putting #include "hardware.h" at the top of special motions .h but it then seemed to be looking into the hardware.h file of the erp folder??

Title: Re: ERP using webbot's Project Designer
Post by: Gertlex on July 21, 2012, 08:59:49 PM
(two answers depending on how I interpret what you're saying your reply)

Yes, "hardware.h" is, for lack of better wording, a catch all for including.  The code that Project Designer outputs should take care of all of the necessary includes within xhardware.h or hardware.h, or something.  Simply including hardware.h in the necessary places takes care of all other Webbotlib includes. (It works well enough that, as Webbot hoped, I don't end up investigating these files, and thus I don't really know)

What do you mean by "seemed to be looking"? Different error message? If so, just post that text using [ code][ /code] tags; you don't need a full screenshot.
Title: Re: ERP using webbot's Project Designer
Post by: mallster on July 21, 2012, 10:26:50 PM
Below is the error showing it is looking for the ERP hardware.h. I have linked to admins ERP folder by the included directories option.

ERP .h files are in
C:/Users/Greg/Documents/ERP_WebbotLib

My walle.prj and studio project files are in-
C:\Users\Greg\webbotlib

My webbot library is in-
C:/Users/Greg/Documents/webbotlib_v2/2.09" 


error msg with hardware.h removed from erp folder:

In file included from Walle_Axon_v2.cpp:19:0:
C:/Users/Greg/Documents/ERP_WebbotLib/special_motions.h:1:22: fatal error: hardware.h: No such file or directory
compilation terminated.
make: *** [Walle_Axon_v2.o] Error 1
Build failed with 1 errors and 0 warnings...

error msg with hardware.h from erp folder:
In file included from C:/Users/Greg/Documents/ERP_WebbotLib/special_motions.h:1:0,
                 from Walle_Axon_v2.cpp:19:
C:/Users/Greg/Documents/ERP_WebbotLib/hardware.h:53:23: warning: large integer implicitly truncated to unsigned type
C:/Users/Greg/Documents/ERP_WebbotLib/hardware.h:54:7: error: conflicting declaration 'SERVO arm_left_J1'
lib/lib_ctor.h:22:14: error: 'arm_left_J1' has a previous declaration as 'Servo arm_left_J1'
C:/Users/Greg/Documents/ERP_WebbotLib/hardware.h:54:21: error: 'B5' was not declared in this scope
C:/Users/Greg/Documents/ERP_WebbotLib/hardware.h:55:21: warning: large integer implicitly truncated to unsigned type
... + 60 more lines of the same errors
Title: Re: ERP using webbot's Project Designer
Post by: Gertlex on July 21, 2012, 10:44:46 PM
Ahh. That helps!  I'm guessing the answer is to copy everything in C:/Users/Greg/Documents/ERP_WebbotLib to C:\Users\Greg\webbotlib.

I've not used the 'included directories' option.  But its probably working as intended.  I would guess that anything in \webbotlib can see stuff in the included directories, but not vice versa.  (typically these included directories/libraries would be completely standalone, which is perhaps more common in non-robotics, e.g. including a library of ODE solvers)

The way I do my projects is I'll create a new folder, save the .prj file in it, and then generate the project in the same folder. Then I'll put all my own code in the same folder. Thus, all of my .c and .h files, and all of the webbotlib-created .h files (including hardware.h) are in the same folder as the .prj (or in some webbotlib-created sub-folders).

(More) What I do... Since Project Designer defaults to that C:\Users\Name\webbotlib folder, and I keep my project folders somewhere else, I have a shortcut in the webbotlib folder that goes to my actual folder full of projects.

Let us know if that solves things! :)
Title: Re: ERP using webbot's Project Designer
Post by: mallster on July 22, 2012, 07:02:29 AM

Yay! I got it to compile.

I changed this in special motions.h:
void get_servo_positions(void)
   {
   position_current[0]=act_getSpeed(&arm_left_base);
   position_current[1]=act_getSpeed(&arm_left_J1);
   position_current[2]=act_getSpeed(&arm_left_J2);
   position_current[3]=act_getSpeed(&arm_left_claw);
   position_current[4]=act_getSpeed(&arm_right_base);
   position_current[5]=act_getSpeed(&arm_right_J1);
   position_current[6]=act_getSpeed(&arm_right_J2);
   position_current[7]=act_getSpeed(&arm_right_claw);
   position_current[8]=act_getSpeed(&camera_hor);
   position_current[9]=act_getSpeed(&camera_ver);

to this:
void get_servo_positions(void)
   {
   position_current[0]=arm_left_shoulder.getSpeed();
   position_current[1]=arm_left_J1.getSpeed();
   position_current[2]=arm_left_wrist.getSpeed();
   position_current[3]=arm_left_hand.getSpeed();
   position_current[4]=arm_left_claw.getSpeed();
   position_current[5]=arm_right_shoulder.getSpeed();
   position_current[6]=arm_right_J1.getSpeed();
   position_current[7]=arm_right_wrist.getSpeed();
   position_current[8]=arm_right_hand.getSpeed();
   position_current[9]=arm_right_claw.getSpeed();
   position_current[10]=camera_hor.getSpeed();
   position_current[11]=camera_ver.getSpeed();