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

Moisture sensors #14

Merged
merged 15 commits into from
Mar 11, 2021
Merged

Moisture sensors #14

merged 15 commits into from
Mar 11, 2021

Conversation

birajsilwal
Copy link

initial commit for moisture sensors

Copy link
Contributor

@Carter90 Carter90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove git, src/moisture_sensors/scripts/talker.py, src/moisture_sensors/src/talker.py files
Fill out src/moisture_sensors/src/test1/package.xml
rename test1 directory to moisture_sensors
Try something like this insted

from gazebo_msgs.srv import GetModelState
import random
model_coordinates = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState)
pots=[(model_coordinates("plant_"+num, "world").pose.position,random.randint(20,500)) for num in range(0,143) ]
pots[50][0] #Point of pot 50
pots[50][0].x #x cord of pot 50
pots[50][0].y #y cord of pot 50
pots[50][0].z #z cord of pot 50
pots[50][1] #mosture of pot 50

or if you want to use

pots=[{pose:model_coordinates("plant_"+num, "world").pose.position,moisture_level:random.randint(20,500)} for num in range(0,143)]
pots[50].pose #Point of pot 50
pots[50].pose.x  #x cord of pot 50
pots[50].moisture_level #mosture of pot 50

disclaimer this code is untested, wrote it without the sim running

@Carter90 Carter90 linked an issue Feb 17, 2021 that may be closed by this pull request
Base automatically changed from master to main February 18, 2021 11:49
moisture decay method works and publishes moisture level
@Carter90
Copy link
Contributor

Carter90 commented Feb 20, 2021

Otherwise looks okay, but in the future please verify that it compiles and runs like below

catkin clean -y
catkin build
source ./devel/setup.bash 
roscore &
rosrun moisture_sensors talker.py &
rostopic echo /moisture

# when done
killall roscore

renamed temperature to moisture
other general update
use list of dictionary to store info of each pot
@Carter90
Copy link
Contributor

Carter90 commented Mar 7, 2021

Cool but could you change to what we've heard the sensors are publishing (besides id that's something I requested)
So a .msg file that looks like this

uint32 id
float32 temp
float32 pot_imp
float32 plant_imp

@Carter90 Carter90 self-requested a review March 11, 2021 08:15
uint32 id
float32 temp
float32 pot_imp
float32 plant_imp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline here would be nice

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it like "String newLine" in the .msg file and then in talker.py, msg.newLine = " " or is there any specific way to have a new line in .msg file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline as in the \n character at the end of the file, its fine I've added it in #34

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it shows up on github if you look at the files view
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. cool. thanks.

Copy link
Contributor

@Carter90 Carter90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs, now my turn to integrate.

@Carter90 Carter90 merged commit c4224e6 into main Mar 11, 2021
@Carter90 Carter90 deleted the moisture_sensors branch March 11, 2021 08:24
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.

Biraj's plant node status topic
3 participants