0
$\begingroup$

Rosanswers logo

Hi, I'm once again working on getting rosserial to work with a atmega168 based motor controller. With the arduino IDE, I can flash the rosserial "hello world" example just fine, but with the cmake-based system, the "make upload" command always aborts at the verification step at about 6 to 20% with "stk500_recv(): programmer is not responding".

I changed node_handle.h like so:

  template<class Hardware,
           int MAX_SUBSCRIBERS=5,
           int MAX_PUBLISHERS=5,
           int INPUT_SIZE=128,
           int OUTPUT_SIZE=128>
  class NodeHandle_

to make the code fit into the limited memory of the atmega168 (It would be good if this could be set without editing in the rosserial_client package btw :) /edit: Just noticed one can actually do this by using ros::NodeHandle_<ArduinoHardware,5,5,128,128> instead of ros:NodeHandle)

What I get when flashing is:

 make upload
[ 76%] Built target diecimila_CORE
[100%] Built target chatter
Scanning dependencies of target chatter-upload
avrdude: successfully opened stk500v1 device -- please use -c stk500v1

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
a    vrdude: erasing chip
avrdude: reading input file "chatter.hex"
avrdude: writing flash (9774 bytes):

Writing | ################################################## | 100% 7.60s

avrdude: 9774 bytes of flash written
avrdude: verifying flash memory against chatter.hex:
avrdude: load data flash data from input file chatter.hex:
avrdude: input file chatter.hex contains 9774 bytes
avrdude: reading on-chip flash data:

Reading | ##########                                         | 19% 1.35savrdude: stk500_recv(): programmer is not responding
make[3]: *** [CMakeFiles/chatter-upload] Error 1
make[2]: *** [CMakeFiles/chatter-upload.dir/all] Error 2
make[1]: *** [CMakeFiles/upload.dir/rule] Error 2
make: *** [upload] Error 2

Is there a quick way to disable the verification step? Seeing how it works with the arduino IDE upload, I suspect that the verification step fails because of timing issues or so and not because flashing went bad.

Update: After updating to most recent mercurial version and setting <ArduinoHardware,4,4,128,128> for nh , I can get the Atmega168 to publish on the chatter topic (Flashing still seems to fail sometimes though). However, if I add a subscriber, I can still flash the system, but rosserial fails to connect every time. If I upload the code using the arduino IDE, it works. Interestingly, the Arduino IDE reports a sketch size of

Binary sketch size: 9282 bytes (of a 14336 byte maximum)

while 'make upload' of the cmake based script tells me

avrdude: writing flash (11220 bytes):

for the exact same code


Originally posted by Stefan Kohlbrecher on ROS Answers with karma: 24361 on 2011-11-29

Post score: 0


Original comments

Comment by Stefan Kohlbrecher on 2011-11-29:
Ahem, yes this is possible. I see I have to work on my mercurial skills :) Will report back later today.

Comment by fergs on 2011-11-29:
ros.h should contain a big series of "#if defined(AVR_ATmega8).." type things, if not, you don't have the latest version (did you possibly "pull" but not "update"?)

Comment by Stefan Kohlbrecher on 2011-11-29:
I'm running the latest version from mercurial, so this should be used already, right? Looking into the sources generated in src/ros_lib for my package, I see the default <25,25,512,512> parameters. Or does this get changed during compilation somehow?

Comment by fergs on 2011-11-29:
The latest release of rosserial (0.3.0) should be setting the node handle parameters based on the chip -- your mega168 would get <6,6,150,150> -- does that not fit in RAM?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Ok, updated it. It now works with a <ArduinoHardware,4,4,128,128> setting (I get chatter topic echoes). With the default nodehandle, I get only sync failed. It appears the hex file is still too large. (It would be great to have a "make size" target btw :) )


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2011-11-30

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.