-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Syntax error compiling base_controller in VSCode+PIO #40
Comments
Hi @joeuser846, this is indeed strange. I noticed you added diffbot/diffbot_base/scripts/base_controller/platformio.ini Lines 11 to 22 in 11ac235
The reason is that the encoder library should be already integrated in the framework-arduino package. There might be an issue with this version of the library, which comes up also in this thread (although it seems to be not directly the same issue you have):
After the program compiles please also make sure to have the Teensyduino GUI installed, explained here: https://ros-mobile-robots.com/teensy-mcu/. Alternatively you could also try the |
Hello. Thanks for your quick reply. To be sure I had not modified anything by accident I removed my repo and cloned it fresh from github. Then I just opened the PIO-ready project at the “diffbot/diffbot_base/scripts/base_controller” directory. I’m attaching a screenshot (below) from VSCode that shows the project file hierarchy and the platformio.ini file exactly as imported. When I build I still get the same syntax errors as you can see in the screenshot.
I’m running VSCode on a MacBook but I’ve never had any problems with incompatibilities in the past. My ROS Noetic system is on Ubuntu but I just find it easier to do my PlatformIO embedded projects on the Mac.
… On Oct 5, 2021, at 4:45 AM, Franz ***@***.***> wrote:
Hi @joeuser846 <https://github.com/joeuser846>, this is indeed strange. I noticed you added paulstoffregen/Encoder@^1.4.1 explicitly in the platformio.ini. As far as I know this shouldn't be required, the platformio.ini I use looks like this:
https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_base/scripts/base_controller/platformio.ini#L11-L22 <https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_base/scripts/base_controller/platformio.ini#L11-L22>
The reason is that the encoder library should be already integrated in the framework-arduino package.
Can you please try compiling after removing this line: paulstoffregen/encoder@^1.4.1 and let me know if this works for you?
There might be an issue with this version of the library, which comes up also in this thread <https://community.platformio.org/t/beginner-who-wants-to-migrate-to-platformio-but-a-lot-of-things-that-i-do-not-understand-my-sketch-works-on-arduino-ide/10371> (although it seems to be not directly the same issue you have):
it seems you have the Encoder library installed in the local library storage via the VSCode UI. This is not necessary since the encoder library is already integrated in the framework-arduino package. If you remove it, it should take the fixed version from the Arduino Package.
force usage of the updated version; that is, in the platformio.ini in the lib_deps directive, instead of saying Encoder give it the git link https://github.com/PaulStoffregen/Encoder.git <https://github.com/PaulStoffregen/Encoder.git>
After the program compiles please also make sure to have the Teensyduino GUI installed, explained here: https://ros-mobile-robots.com/teensy-mcu/ <https://ros-mobile-robots.com/teensy-mcu/>. Alternatively you could also try the teensy-cli upload_protocol <https://docs.platformio.org/en/latest/platforms/teensy.html#uploading-using-cli> without installing the GUI. Would be interesting to know if it works also without installing the GUI, because I have always installed and used the Teensyduino GUI so far.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#40 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJXEBBPXJ74IE4MEJYYFF3UFK3JBANCNFSM5FKWT2KQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I am sorry you ran into this issue, I didn't expect someone will build on other OS than Ubuntu and that this would cause an issue. I can confirm that the The problem can be solved by renaming You can try this solution for now. If it works for you, a pull request with a suitable new name for the header is most welcome :-) Otherwise please just let me know if it works and I probably will fix this in the near future. |
Thanks! That fixed it. Kind of an interesting situation though. It never occurred to me that a working VSCode+PIO project wouldn’t be portable. There’s always more to learn I guess.
… On Oct 5, 2021, at 7:17 PM, Franz ***@***.***> wrote:
I am sorry you ran into this issue, I didn't expect someone will build on other OS than Ubuntu and that this would cause an issue.
I can confirm that the base_controller doesn't compile on Windows either. It is a letter case issue. The problem is that Windows and seemingly macOS are case-insensitive to header file names. Ubuntu is case-sensitive and therefore "encoder.h" and <Encoder.h> are treated differently only on Ubuntu. For Windows and macOS these are the same header.
The problem can be solved by renaming encoder.h (and encoder.cpp) to something else. For example, I tried with encoder_diffbot.h, which makes the script compile successfully on Windows.
You can try this solution for now. If it works for you, a pull request with a suitable new name for the header is most welcome :-) Otherwise please just let me know if it works and I probably will fix this in the near future.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#40 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJXEBALL46UZ2YMU7MK5RLUFOBSPANCNFSM5FKWT2KQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hello again.
I've successfully got my RPi4 based diffbot driving around using rqt (robot steering) from my development system (Ubuntu on VirtualBox on a Mac). Now I’m trying to move to the next step and enable navigation. I start roscore on the development system and point the diffbot to it and then launch ‘bringup_with_laser.launch’ and everything seems good. I get valid looking data in /diffbot/scan on both systems.
But when I ‘roslaunch diffbot_slam diffbot_slam.launch slam_method:=gmapping’ on the development system I don’t see any lidar data points in rviz I get two errors that I don’t quite know how to interpret:
In rviz:
Transform [sender=unknown_publisher]
For frame [rplidar_gpu_laser_link]: Frame [rplidar_gpu_laser_link] does not exist
and in the terminal from which I launched diffbot_slam I get this repeating warning:
[ WARN] [1635345613.864692611]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_filter] rosconsole logger to DEBUG for more information.
Any help on why the points don’t seem to be registering in rviz would be appreciated. After a lot of googling this seems to be a TF issue perhaps? I’m a ROS newbie so I must admit I get lost in all the discussions about frames. I did check that the date/time on both systems is correctly synced to ntp.ubuntu.com but I still have the problem.
Regards,
Ian
PS: There’s a small typo in the README on github.
This command: roslaunch diffbot_bringup diffbot_bringup_with_laser.launch
should be: roslaunch diffbot_bringup bringup_with_laser.launch
… On Oct 5, 2021, at 8:34 PM, Joe User ***@***.***> wrote:
Thanks! That fixed it. Kind of an interesting situation though. It never occurred to me that a working VSCode+PIO project wouldn’t be portable. There’s always more to learn I guess.
> On Oct 5, 2021, at 7:17 PM, Franz ***@***.*** ***@***.***>> wrote:
>
>
> I am sorry you ran into this issue, I didn't expect someone will build on other OS than Ubuntu and that this would cause an issue.
>
> I can confirm that the base_controller doesn't compile on Windows either. It is a letter case issue. The problem is that Windows and seemingly macOS are case-insensitive to header file names. Ubuntu is case-sensitive and therefore "encoder.h" and <Encoder.h> are treated differently only on Ubuntu. For Windows and macOS these are the same header.
>
> The problem can be solved by renaming encoder.h (and encoder.cpp) to something else. For example, I tried with encoder_diffbot.h, which makes the script compile successfully on Windows.
>
> You can try this solution for now. If it works for you, a pull request with a suitable new name for the header is most welcome :-) Otherwise please just let me know if it works and I probably will fix this in the near future.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub <#40 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJXEBALL46UZ2YMU7MK5RLUFOBSPANCNFSM5FKWT2KQ>.
> Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
|
Hi @joeuser846 thanks for reporting this issue and the typo. Looks like a naming mistake of the the link (frame) in the diffbot_description urdf and the frame id used in
Can you please try again after changing the default value from |
I assume the suggested solution in my previous comment won't solve the issue. However, a possible solution is to modify the
to
Or you can add an argument, which I will do to fix this issue:
Would be great to know if this gets rid of the error messages. |
Definitely make sure to rename |
Making just the change below fixed it.
This is by far the best project I’ve found for building a navigating diff drive robot. I was actually a bit shocked at how little help practical/beginner there is out there. I tried the “nox project” and it’s OK but it uses an obsolete hack for diff drive control and is based on an old school Kinect sensor. I also played with Duckietown but that’s all about following a standardized road with camera sensing. I wanted a tracked (tank style) robot to navigate around my house across different surfaces (hardwood, rugs, carpet, thresholds) and Diffbot is it for sure. The pid function does a great job of maintaining the set speed as the surface friction changes. Now on to better understanding SLAM and navigation.
Thanks for all your hard work on this project and for sharing it so freely.
Regards,
Ian
… On Oct 27, 2021, at 4:28 PM, Franz ***@***.***> wrote:
Hi @joeuser846 <https://github.com/joeuser846> thanks for reporting this issue and the typo.
Looks like a naming mistake of the the link (frame) in the diffbot_description urdf <https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_description/urdf/include/common_sensors.xacro#L19> and the frame id used in bringup_with_laser.launch <https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_bringup/launch/bringup_with_laser.launch#L2>:
https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_bringup/launch/bringup_with_laser.launch#L2 <https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_bringup/launch/bringup_with_laser.launch#L2>
Can you please try again after changing the default value from rplidar_gpu_laser_link to rplidar_laser_link in thebringup_with_laser.launch <https://github.com/ros-mobile-robots/diffbot/blob/11ac235b474b81226086e7af45f786e5e87ec7e8/diffbot_bringup/launch/bringup_with_laser.launch#L2>and let me know if this is working?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#40 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJXEBCXR6LJOQQRFJPWZY3UJBVGZANCNFSM5FKWT2KQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Thank you Ian for sharing this kind feedback! Glad to hear, the project is useful to you. I started it because I was facing the same difficulties as you mention. Congrats to you on getting this far and setting up your own robot 👏 The documentation on slam, navigation and robotics theory might also give you some starting points to explore more, although it is far from complete. In case you run into any new errors or have suggestions to improve the project (documentation or code), please don't hesitate to open a new issue or discussion. Valuable feedback from collaborators like you is most welcome and helps to improve the project. Best regards |
- Rename rplidar_gpu_laser_link to rplidar_laser_link in bringup_with_laser.launch - Add rplidar.launch to diffbot_bringup to support framed_id argument - Make use of new diffbot_bringup/launch/rplidar.launch in bringup_with_laser.launch This solves issues in RViz: Transform [sender=unknown_publisher] For frame [rplidar_gpu_laser_link]: Frame [rplidar_gpu_laser_link] does not exist and in the terminal from whic diffbot_slam is launched: [ WARN] [1635345613.864692611]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_filter] rosconsole logger to DEBUG for more information.
I've imported the base_controller project directory into VSCode+PIO. I added the Paul Stoffregen "Encoder" library but when I build I get the following syntax errors. I'd really appreciate a little guidance on what I did wrong and how to fix it. The issue seems to have something to do with namespace and scope, but exactly what? Thanks in advance for any help.
[platformio]
default_envs = teensy31
[env:teensy31]
platform = teensy
board = teensy31
framework = arduino
lib_deps =
frankjoshua/Rosserial Arduino Library@^0.9.1
./lib
adafruit/Adafruit Motor Shield V2 Library@^1.0.11
Wire
paulstoffregen/Encoder@^1.4.1
Building in release mode
Compiling .pio/build/teensy31/src/main.cpp.o
Compiling .pio/build/teensy31/lib821/SPI/SPI.cpp.o
Compiling .pio/build/teensy31/lib8c6/Ethernet/Dhcp.cpp.o
Compiling .pio/build/teensy31/lib8c6/Ethernet/Dns.cpp.o
In file included from .pio/libdeps/teensy31/lib/base_controller.h:17:0,
from src/main.cpp:4:
lib/encoder/encoder.h:39:11: error: 'Encoder' in namespace '::' does not name a type
::Encoder encoder;
^
lib/encoder/encoder.h: In member function 'int32_t diffbot::Encoder::read()':
lib/encoder/encoder.h:89:40: error: 'encoder' was not declared in this scope
inline int32_t read() { return encoder.read(); };
^
lib/encoder/encoder.h: In member function 'void diffbot::Encoder::write(int32_t)':
lib/encoder/encoder.h:97:40: error: 'encoder' was not declared in this scope
inline void write(int32_t p) { encoder.write(p); };
^
The text was updated successfully, but these errors were encountered: