Subject:
|
RE: RCX & RIS, a fading glory?
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Thu, 6 Feb 2003 18:38:28 GMT
|
Original-From:
|
Andrew J. Huang <ajhuang@velocitus.net{stopspammers}>
|
Viewed:
|
849 times
|
| |
| |
Marco thought:
> hmmm... I prefer the method using a High_Level map in the
> source code or as a .h file
From a code writing point of view, defining macros
that identify the motor is much nicer than having
to list out the path to the motor. However, when
you have to replace a dodgy motor on an
individual, you'll have to re-map the motor name
(revise the .h) and then recompile. If you're on
Mars, or at a standalone (no reprogramming)
competition, a recompile and download isn't
convenient.
A route to the motor isn't so bad since it can be
encoded as a macro just the same:
#define RightHand_Finger1 down_neck, \
first_right_appendage, \
past_rotator_cuff, \
past_elbow-joint, \
first_daisy chain
...
do_thumb(degrees) {
packet = create_packet();
setPacketDest(packet, RightHandFinger1);
if (degrees > 0)
packet->command = MOTOR_ON_CCW
else
packet->command = MOTOR_ON_CW
packet->value = degrees*SECS_PER_DEGREE;
sendPacket(packet);
free_packet(packet);
}
This is pretty similar to what you suggested, but
abstracting the operations to a little higher
level.
The main codeline should then look like:
main()
do_thumb(10);
do_forefinger(MAX);
etc.
However, the main point is that you can hide an
arbitrary amount of code ugliness.
Best regards,
Andy
|
|
Message has 1 Reply: | | RE: RCX & RIS, a fading glory?
|
| (...) Yes, you're right. :) The alternative would be to tweak the Device_ID/Friendly_Device_Name table in real-time, updating the new Device_ID. Then, the compile-time table with the Friendly_Device_Name...cific_Name would still valid. (...) Seconds (...) (22 years ago, 11-Feb-03, to lugnet.robotics)
|
Message is in Reply To:
| | RE: RCX & RIS, a fading glory?
|
| (...) hmmm... I prefer the method using a High_Level map in the source code or as a .h file ///.../// #IFDEF _TWINROBOTA_ #INCLUDE 'TwinRobotA_devmap.h' #ENDIF #IFDEF _TWINROBOTB_ #INCLUDE 'TwinRobotB_devmap.h' #ENDIF #IFDEF _TWINROBOTC_ #INCLUDE (...) (22 years ago, 6-Feb-03, to lugnet.robotics)
|
8 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|