[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave/C++
From: |
Mike Morley |
Subject: |
Re: Octave/C++ |
Date: |
26 Jul 2005 10:50:47 +0100 |
I've tried this code, but I'm still experiencing some problems:
- The line "rbc.opcode = args(1).int_value();" throws up an invalid
conversion error
- I tried replacing the getlink line with "b->Bot.robot.command(rbc,
args(2).intvalue());" (no ofcourse checking ags.length() = 3) but I get an
invalid use error message. I did this replace placement because I don't
understand how to implement the getlink command.
- I also tried putting in the robot.initialise() command in to initialise
the robot link, but this produced errors wherever I seemed to put it.
- I get a "Bot3.cpp:80:1: warning: unknown escape sequence: '\040'" message
appearing twice when I run mkoctfile.
Any help would as usual be appreciated, many thanks,
Mike.
On Jul 25 2005, Stefan van der Walt wrote:
Hi Mike
The function to access the robot could look something like (from the
top of my head)
DEFUN_DLD(robot_cmd, args, argv,
"Send a cmd to the robot\n\
\n\
usage: robot_cmd(robot, cmd)")
{
octave_value_list retval;
if (args.length() != 2) {
print_usage("robot");
return retval;
}
if (args(0).type_id() != Bot::static_type_id()) {
print_usage("robot");
return retval;
}
robot_command rbc;
rbc.opcode = args(1).int_value();
if (error_state) {
error("robot_cmd: expected integer command");
return retval;
}
Bot *b = (Bot*)args(0).internal_rep();
b->get_link() << rbc;
return retval;
}
You'll have to add the get_link() method to the Bot class. Also, I
didn't make provision for parameters above.
Regards
Stéfan
On Mon, Jul 25, 2005 at 10:50:45AM +0100, Mike Morley wrote:
> I tried the code you provided this morning linking to the header
> files, and it appears to work.
>
> The problem I now have is how do I run commands to the robot?
>
> I've looked at make_int.cc but I don't really understand the syntax I
> need to use to make things work.
>
> Ideally, what I need is some way of issuing a command in octave like:
>
> robotcommand (robot, motor1go, speed) that would run the C++ command
> robot.command (MOTOR_1_GO, speed)
>
> So what I guess I need is some switch statement to convert the string
> into the appropriate robot command statement, and then pick up the
> other variable to pass to the robot. However, I'm not sure how to
> implement this.
>
> Mike
--
--
Mike Morley
Trinity College, Cambridge
mjm80 | 07862 282608
Part II Experimental and Theoretical Physics
- Temporarily an Engineer -
Director of IT, Cambridge Union Society
www.cambridge-union.org
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: Octave/C++, (continued)
- Re: Octave/C++, Søren Hauberg, 2005/07/22
- Re: Octave/C++, Geraint Paul Bevan, 2005/07/22
- Re: Octave/C++, Mike Morley, 2005/07/22
- Re: Octave/C++, Søren Hauberg, 2005/07/22
- Re: Octave/C++, Geraint Paul Bevan, 2005/07/22
- Re: Octave/C++, Mike Morley, 2005/07/22
- Re: Octave/C++, Mike Morley, 2005/07/22
- Re: Octave/C++, John W. Eaton, 2005/07/22
- Re: Octave/C++, Mike Morley, 2005/07/25
- Re: Octave/C++, Stefan van der Walt, 2005/07/25
- Re: Octave/C++,
Mike Morley <=
Re: Octave/C++, Raphael Schneider, 2005/07/22