Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 3 4 
Send Topic Print
Executing C-programs (Read 32122 times)
randy
YaBB Newbies
*




Posts: 32
Re: Executing C-programs
Reply #15 - 03/28/08 at 2:38am
 
I have the same problem that I uploaded c program in a txt to srv1,  
type "Q" and there's no response unless restarted.
The program is workable in another srv1.
 
I have uploaded the last firmware ( - 19:09:37 - Mar 11 2008), finally this problem solved.
Below is what I have done:
 
1. After uploaded the firmware, it shows  "##zZ boot image write count: 131072". But I type "2" in TeraTerm, it wont move.
2. I use SRV1Console connect to srv1. It work normally.
3. Close SRV1Console and back to TeraTerm, I can type "2", then it moves.
4. I test with c program, it works.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #16 - 03/28/08 at 7:26am
 
The issue with the '2' command is that an 'M' command has to be issued first to initialize the motors.  We had to add this initialization requirement when we added support for servos with the 'S' and 's' command.  The problem was that the numeric keypad commands don't work with the servos, so we disable them unless we're certain that the robot is running in PWM mode.  The first 'M' command initializes the timers for PWM, and then the numeric commands will work.
 
The motors(xx, xx); command has the same effect of initializing the timers for PWM, so afterwards, the numeric commands such as '2' will work.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
randy
YaBB Newbies
*




Posts: 32
Re: Executing C-programs
Reply #17 - 04/01/08 at 1:22am
 
Thanks. I dont notice that we shall give 'Mabc' before '2'.
I still encounter no response when executing c program.
It’s confusing that we have no idea what happened.
Up to now I just uploaded the firmware to see if the problem disappear.
Maybe Lithp wont have this issue.
Back to top
 
« Last Edit: 04/01/08 at 2:30am by randy »  
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #18 - 04/01/08 at 8:26am
 
You should try a really simple C program first just to make certain that things are working.
 
main()
{
    print("hello");
}
 
 
If that works, try
 
main()
{
    motors(50, 50);
    delay(500);
    motors(0, 0);
}
 
Once you have both of these programs working, we can work on some more complex behavior.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
randy
YaBB Newbies
*




Posts: 32
Re: Executing C-programs
Reply #19 - 04/01/08 at 6:27pm
 
Thanks. I'm used to give the c program:
 
main()
{
   int i, j, k;
   for(i = 0; i < 5; i = i + 1) {
     for(j = 0; j < 3; j = j + 1) {
      for(k = 3; k ; k = k - 1) {
        print(i);
        print(j);
        print(k);
      }
     }
   }
}
 
Now it works well with all these programs, but yesterday it indeed got no response.
I think it's strange, and someone may get confused like me.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #20 - 04/01/08 at 7:12pm
 
Glad to hear that it is working now.  The C interpreter just runs whatever code is in the flash buffer, and you can always check the contents of the flash buffer with the 'zd' command.  
 
Occasionally I see strange behavior with the C interpreter, but it is probably because I get confused about what code is actually in the flash buffer.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
randy
YaBB Newbies
*




Posts: 32
Re: Executing C-programs
Reply #21 - 04/02/08 at 3:30am
 
I always use the same code to test.
Sometimes I got the text with 'zr' 'zd', what is read from user flash section:
 
         main()
{
    print("hello");
}
 - 1) {
        print(i);
        print(j);
        print(k);
      }
     }
   }
}
 
 
I guess it maybe necessary to use 'zc' to clean the flash buffer.
Or in c program, there's some unvisible char when I copy from website.
 
I just find out that every time I turn on srv1, sometimes 'Q' works and sometimes doesn't.  
And I usually use 'X', 'zd' then 'Q'. So I have some guess.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #22 - 04/03/08 at 8:14am
 
I did find one problem yesterday in our code with the 'zd' command - it wasn't using hardware flow control, so sometimes characters could be lost when the flash buffer was displayed.  The buffer contents themselves were fine, but the display was scrambled such as you show above.  I'll post a firmware update later today that includes a fix for this problem.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wmcnab
YaBB Newbies
*




Posts: 30
Re: Executing C-programs
Reply #23 - 04/21/08 at 5:45pm
 
I've had no problems with the test programs, however I can't seem to get an if/then statement to work.
 
In the program below I get the error:  'semicolon expected in line 3'
 
main()  
{
  if ((sonar(1)/100)<=12)
       servo(50,50);
  else  
       print("Testing");
}  
 
All the if/then variations I've tried get the same result.
 
Am I missing something?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #24 - 04/21/08 at 6:40pm
 
Looks like the interpreter doesn't like the function call inside the if() statement.  Try this instead -
 
main()
{
  int x;
 
  x = sonar(1);
  if (x <= 1200)
    print("stop");
  else
    print("drive");
}
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wmcnab
YaBB Newbies
*




Posts: 30
Re: Executing C-programs
Reply #25 - 04/22/08 at 4:05pm
 
Interesting.  I get no response from that program at all.
 
If I put a print statement before the 'if' statement, it prints that statement fine.  However, nothing happens from the 'if' statement on.  
 
It's not frozen as I can type 'V' and get the Version info displayed...
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #26 - 04/22/08 at 4:31pm
 
That is odd.  I cut the code straight from this web page and pasted into the line editor and it worked for me.
 
You might also try
 
main()
{
  int x;
 
  x = sonar(1);
  print("sonar1 = " x);
  if (x <= 1200)
    print("stop");
  else
    print("drive");
}
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wmcnab
YaBB Newbies
*




Posts: 30
Re: Executing C-programs
Reply #27 - 04/22/08 at 8:07pm
 
Weird.  I cut and pasted the first one with the result I mentioned.  
 
I cut and pasted the last one and got: sonar1 =       1622
 
I re-flashed the .ldr and I get the same thing:  sonar1 =       1600         ( But nothing else after the print statement )
 
I'm using the srv1-c.ldr.2500k dated 041208.  I'm also using shamcom to transfer the files.  I can't get teraterm to complete a transfer at all.
 
 
 
 
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #28 - 04/23/08 at 7:19am
 
I have seen some problems using XMODEM to transfer text files in adhoc network mode, and don't know what would be causing this.  In any case, what I've been using is a program called netcat (nc), which is built into Linux and OS/X, and can be downloaded for Windows (install in \windows\system32).  
 
nc is a simple terminal program - if your matchport IP is 169.254.0.10, you invoke from a Windows command shell (Start Run Cmd) with
      nc 169.254.0.10 10001
 
From there, it's like using telnet in line mode.  First clear your flash buffer with 'zc', then invoke the SRV-1 line editor with 'E', then enter 'i' to insert text, then paste your program into the window, then hit ESC to exit the insert mode, and 'x' to exit the editor.  Use 'zd' to confirm the contents of the flash buffer, then try to run your program ('Q').
 
Let me know whether this resolves the problem.
 
netcat docs -  
    http://www.vulnwatch.org/netcat/readment.txt
netcat download -  
    http://www.vulnwatch.org/netcat/nc111nt.zip
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wmcnab
YaBB Newbies
*




Posts: 30
Re: Executing C-programs
Reply #29 - 04/23/08 at 3:24pm
 
I can't get netcat to recognize the ESC, so I can never leave the insert mode.  I tried disconnecting, then re-connecting with shamcom and was then able to ESC out of the editor.  It didn't make any difference though.
 
I'm using my local wireless network, not adhoc mode to control the srv1 at the moment.  I've not had any problems using Shamcom either, as the other program attempts seem to work fine.  It just doesn't like the 'if' statement.
 
I tried my original srv1 as well.  It doesn't have the sonar sensors, but I expect it should just give me a zero reading for the range.  This is what I got as a result:
sonar1 =          0stopnot a variable in line       10semicolon expected in line
      10    pdrive  
 
This was for the program in the last code you posted here.  Also using the srv1-c.ldr.2500k dated 041208.
 
If I use the 03 April ldr I get this response for the same program:
sonar1 =          0stopnot a variable in line       10semicolon expected in line
      10    pdrivestack_ptr = FFB00F9Cheap_ptr  = 00080000
 
I have another laptop that has linux on it and may give that a try.  I know just enough about linux to get in trouble, but I'll see what happens and let you know.
Back to top
 
 
  IP Logged
Pages: 1 2 3 4 
Send Topic Print