Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generate.py] Fix bug of write_constants #59

Closed
wants to merge 4 commits into from

Conversation

taichiH
Copy link

@taichiH taichiH commented Dec 3, 2018

Now, we cannot get a default boolean rosmsg value.

For example, if create test_msg.msg message in eus_test_msg package like below,

bool flag
bool FLAG=1

I always get nil as a default value even though I set FLAG=1.

1.irteusgl$ ros::load-ros-manifest "eus_msg_test"           
t                                                                               
2.irteusgl$ setq msg (instance eus_msg_test::test_msg :init)                    
#<eus_msg_test::test_msg #X6396318>                                                                                                                        
3.irteusgl$ send msg :flag eus_msg_test::test_msg::*flag*                       
nil

The cause of this problem is this line.

s.write('(defconstant %s::%s::*%s* %s)'%(spec.package, spec.actual_name, c.name.upper(), "t" if c.val == "True" else "nil"))

This line's "True" should not be string value.

"t" if c.val == "True" else "nil"

after fix like below, I got correct boolean default value.

"t" if c.val == True else "nil"

@k-okada
Copy link
Member

k-okada commented Dec 3, 2018 via email

@taichiH
Copy link
Author

taichiH commented Dec 7, 2018

@k-okada

  1. I added test code.
  2. I checked roscpp and rospy behavior, as a result, I correctly got True from both.

@taichiH
Copy link
Author

taichiH commented Dec 7, 2018

@k-okada Maybe I got mistake. Is it correct to add geneus test in https://github.com/jsk-ros-pkg/jsk_roseus/blob/master/roseus/test/test-geneus.l ?

k-okada added a commit to k-okada/geneus that referenced this pull request Jan 9, 2019
k-okada added a commit to k-okada/geneus that referenced this pull request Jan 9, 2019
k-okada added a commit to k-okada/geneus that referenced this pull request Jan 9, 2019
k-okada added a commit to k-okada/geneus that referenced this pull request Jan 9, 2019
k-okada added a commit to k-okada/geneus that referenced this pull request Jan 15, 2019
k-okada added a commit that referenced this pull request Jan 16, 2019
@k-okada
Copy link
Member

k-okada commented Jan 16, 2019

@taichiH thank you for improvement. your patch has been merged via #62

@k-okada k-okada closed this Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants